Rename year directories to allow natural ordering
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -0,0 +1,51 @@
|
||||
// Andrew Hayes, ID: 21321503
|
||||
// some of the comments here are quite obvious, and are just here for my own learning purposes
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour {
|
||||
// inspector settings
|
||||
public GameObject mars;
|
||||
public GameObject phobos;
|
||||
public GameObject deimos;
|
||||
|
||||
// speed that the camera moves around mars on arrow keypress
|
||||
public float cameraSpeed = 5.0f;
|
||||
|
||||
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
// set position of mars object and point camera at it
|
||||
mars.transform.position = new Vector3(0,0,0);
|
||||
mars.transform.rotation = Quaternion.Euler(new Vector3(270,0,0)); // make it so mars' north pole points up
|
||||
Camera.main.transform.position = new Vector3(0,0,-100);
|
||||
Camera.main.transform.LookAt(mars.transform);
|
||||
|
||||
// before this can run, you need to manually add a rigid body with 0 angular velocity and no gravity in the UI
|
||||
// start mars rotating
|
||||
mars.GetComponent<Rigidbody>().AddTorque(new Vector3(0,20,0));
|
||||
}
|
||||
|
||||
void Update() {
|
||||
// rotate phobos and deimos a little each frame
|
||||
phobos.transform.RotateAround(mars.transform.position, Vector3.up, 32*Time.deltaTime);
|
||||
deimos.transform.RotateAround(mars.transform.position, Vector3.up, 8*Time.deltaTime);
|
||||
|
||||
// control the camera's position using the arrow keys
|
||||
if (Input.GetKey(KeyCode.LeftArrow)) {
|
||||
Camera.main.transform.RotateAround(mars.transform.position, Vector3.up, cameraSpeed);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.RightArrow)) {
|
||||
Camera.main.transform.RotateAround(mars.transform.position, Vector3.up, -cameraSpeed);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.UpArrow)) {
|
||||
Camera.main.transform.RotateAround(mars.transform.position, Vector3.right, cameraSpeed);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.DownArrow)) {
|
||||
Camera.main.transform.RotateAround(mars.transform.position, Vector3.right, -cameraSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,74 @@
|
||||
%! TeX program = lualatex
|
||||
\documentclass[a4paper, 11pt]{article}
|
||||
|
||||
|
||||
% packages
|
||||
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
|
||||
\usepackage[english]{babel} % Language hyphenation and typographical rules
|
||||
\usepackage[final, colorlinks = false, urlcolor = cyan]{hyperref}
|
||||
\usepackage{changepage} % adjust margins on the fly
|
||||
\usepackage{fontspec}
|
||||
|
||||
\usepackage{minted}
|
||||
\usepackage{xcolor}
|
||||
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{width=\textwidth,compat=1.9}
|
||||
|
||||
\usepackage{caption}
|
||||
\newenvironment{code}{\captionsetup{type=listing}}{}
|
||||
|
||||
\usepackage[yyyymmdd]{datetime}
|
||||
\renewcommand{\dateseparator}{-}
|
||||
\setmainfont{EB Garamond}
|
||||
\setmonofont[Scale=MatchLowercase]{Deja Vu Sans Mono}
|
||||
|
||||
\usepackage{titlesec}
|
||||
% \titleformat{\section}{\LARGE\bfseries}{}{}{}[\titlerule]
|
||||
% \titleformat{\subsection}{\Large\bfseries}{}{0em}{}
|
||||
% \titlespacing{\subsection}{0em}{-0.7em}{0em}
|
||||
%
|
||||
% \titleformat{\subsubsection}{\large\bfseries}{}{0em}{$\bullet$ }
|
||||
% \titlespacing{\subsubsection}{1em}{-0.7em}{0em}
|
||||
|
||||
% margins
|
||||
\addtolength{\hoffset}{-2.25cm}
|
||||
\addtolength{\textwidth}{4.5cm}
|
||||
\addtolength{\voffset}{-3.25cm}
|
||||
\addtolength{\textheight}{5cm}
|
||||
\setlength{\parskip}{0pt}
|
||||
\setlength{\parindent}{0in}
|
||||
% \setcounter{secnumdepth}{0}
|
||||
|
||||
\begin{document}
|
||||
\hrule \medskip
|
||||
\begin{minipage}{0.295\textwidth}
|
||||
\raggedright
|
||||
\footnotesize
|
||||
\textbf{Name:} Andrew Hayes \\
|
||||
\textbf{E-mail:} \href{mailto://a.hayes18@universityofgalway.ie}{a.hayes18@universityofgalway.ie} \hfill\\
|
||||
\textbf{ID:} 21321503 \hfill
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.4\textwidth}
|
||||
\centering
|
||||
\vspace{0.4em}
|
||||
\Large
|
||||
\textbf{CT3536} \\
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.295\textwidth}
|
||||
\raggedleft
|
||||
\today
|
||||
\end{minipage}
|
||||
\medskip\hrule
|
||||
\begin{center}
|
||||
\normalsize
|
||||
\textbf{Assignment 01: Fear \& Dread}
|
||||
\end{center}
|
||||
\hrule
|
||||
|
||||
\begin{code}
|
||||
\inputminted[texcl, mathescape, breaklines, frame=single]{csharp}{../GameManagerScript.cs}
|
||||
\caption{\texttt{GameManagerScript.cs}}
|
||||
\end{code}
|
||||
|
||||
\end{document}
|
Binary file not shown.
@ -0,0 +1,34 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class AsteroidScript : MonoBehaviour
|
||||
{
|
||||
public GameObject asteroid;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
// set asteroid start position to a random plae to the left of mars
|
||||
asteroid.transform.position = new Vector3(-500,Random.Range(-250, 250),Random.Range(-250,250));
|
||||
|
||||
// adding force to the asteroir
|
||||
asteroid.GetComponent<Rigidbody>().AddForce(Vector3.right * 200000 * Time.deltaTime);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
// destroy object if it goes off the right edge of the screen
|
||||
Vector3 position = Camera.main.WorldToScreenPoint(transform.position);
|
||||
if (position.x > Screen.width) {
|
||||
Destroy(asteroid);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// destroy asterod upon collisions
|
||||
void OnCollisionEnter() {
|
||||
Destroy(asteroid);
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// Andrew Hayes, ID: 21321503
|
||||
// some of the comments here are quite obvious, and are just here for my own learning purposes
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameManager : MonoBehaviour {
|
||||
// inspector settings
|
||||
public GameObject mars;
|
||||
public GameObject phobos;
|
||||
public GameObject deimos;
|
||||
public GameObject asteroid;
|
||||
|
||||
// speed that the camera moves around mars on arrow keypress
|
||||
public float cameraSpeed = 500;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
// set position of mars object and point camera at it
|
||||
mars.transform.position = new Vector3(0,0,0);
|
||||
mars.transform.rotation = Quaternion.Euler(new Vector3(270,0,0)); // make it so mars' north pole points up
|
||||
Camera.main.transform.position = new Vector3(0,0,-100);
|
||||
Camera.main.transform.LookAt(mars.transform);
|
||||
|
||||
// before this can run, you need to manually add a rigid body with 0 angular velocity and no gravity in the UI
|
||||
// start mars rotating
|
||||
mars.GetComponent<Rigidbody>().AddTorque(new Vector3(0,20,0));
|
||||
}
|
||||
|
||||
void Update() {
|
||||
// rotate phobos and deimos a little each frame
|
||||
phobos.transform.RotateAround(mars.transform.position, Vector3.up, 32*Time.deltaTime);
|
||||
deimos.transform.RotateAround(mars.transform.position, Vector3.up, 8*Time.deltaTime);
|
||||
|
||||
// control the camera's position using the arrow keys
|
||||
if (Input.GetKey(KeyCode.LeftArrow)) {
|
||||
Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, cameraSpeed * Time.deltaTime);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.RightArrow)) {
|
||||
Camera.main.transform.RotateAround(Vector3.zero, Vector3.up, -cameraSpeed * Time.deltaTime);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.UpArrow)) {
|
||||
Camera.main.transform.RotateAround(Vector3.zero, Vector3.right, cameraSpeed * Time.deltaTime);
|
||||
}
|
||||
else if (Input.GetKey(KeyCode.DownArrow)) {
|
||||
Camera.main.transform.RotateAround(Vector3.zero, Vector3.right, -cameraSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
// randomly spawn new asteroids
|
||||
if (Random.Range(1,180) == 1) { // assuming Update() is called 60 times per second, want to spawn a new asteroid on average once every 3 seconds
|
||||
Instantiate(asteroid); // instantiating asteroid prefab
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,79 @@
|
||||
%! TeX program = lualatex
|
||||
\documentclass[a4paper, 11pt]{article}
|
||||
|
||||
|
||||
% packages
|
||||
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
|
||||
\usepackage[english]{babel} % Language hyphenation and typographical rules
|
||||
\usepackage[final, colorlinks = false, urlcolor = cyan]{hyperref}
|
||||
\usepackage{changepage} % adjust margins on the fly
|
||||
\usepackage{fontspec}
|
||||
|
||||
\usepackage{minted}
|
||||
\usepackage{xcolor}
|
||||
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{width=\textwidth,compat=1.9}
|
||||
|
||||
\usepackage{caption}
|
||||
\newenvironment{code}{\captionsetup{type=listing}}{}
|
||||
|
||||
\usepackage[yyyymmdd]{datetime}
|
||||
\renewcommand{\dateseparator}{-}
|
||||
\setmainfont{EB Garamond}
|
||||
\setmonofont[Scale=MatchLowercase]{Deja Vu Sans Mono}
|
||||
|
||||
\usepackage{titlesec}
|
||||
% \titleformat{\section}{\LARGE\bfseries}{}{}{}[\titlerule]
|
||||
% \titleformat{\subsection}{\Large\bfseries}{}{0em}{}
|
||||
% \titlespacing{\subsection}{0em}{-0.7em}{0em}
|
||||
%
|
||||
% \titleformat{\subsubsection}{\large\bfseries}{}{0em}{$\bullet$ }
|
||||
% \titlespacing{\subsubsection}{1em}{-0.7em}{0em}
|
||||
|
||||
% margins
|
||||
\addtolength{\hoffset}{-2.25cm}
|
||||
\addtolength{\textwidth}{4.5cm}
|
||||
\addtolength{\voffset}{-3.25cm}
|
||||
\addtolength{\textheight}{5cm}
|
||||
\setlength{\parskip}{0pt}
|
||||
\setlength{\parindent}{0in}
|
||||
% \setcounter{secnumdepth}{0}
|
||||
|
||||
\begin{document}
|
||||
\hrule \medskip
|
||||
\begin{minipage}{0.295\textwidth}
|
||||
\raggedright
|
||||
\footnotesize
|
||||
\textbf{Name:} Andrew Hayes \\
|
||||
\textbf{E-mail:} \href{mailto://a.hayes18@universityofgalway.ie}{a.hayes18@universityofgalway.ie} \hfill\\
|
||||
\textbf{ID:} 21321503 \hfill
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.4\textwidth}
|
||||
\centering
|
||||
\vspace{0.4em}
|
||||
\Large
|
||||
\textbf{CT3536} \\
|
||||
\end{minipage}
|
||||
\begin{minipage}{0.295\textwidth}
|
||||
\raggedleft
|
||||
\today
|
||||
\end{minipage}
|
||||
\medskip\hrule
|
||||
\begin{center}
|
||||
\normalsize
|
||||
\textbf{Assignment 02}
|
||||
\end{center}
|
||||
\hrule
|
||||
|
||||
\begin{code}
|
||||
\inputminted[texcl, mathescape, breaklines, frame=single]{csharp}{../code/GameManagerScript.cs}
|
||||
\caption{\texttt{GameManagerScript.cs}}
|
||||
\end{code}
|
||||
|
||||
\begin{code}
|
||||
\inputminted[texcl, mathescape, breaklines, frame=single]{csharp}{../code/AsteroidScript.cs}
|
||||
\caption{\texttt{AsteroidScript.cs}}
|
||||
\end{code}
|
||||
|
||||
\end{document}
|
Reference in New Issue
Block a user