Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class Archer : MonoBehaviour | ||
{ | ||
public int ammo = 5; | ||
|
||
public Transform target;//set target from inspector instead of looking in Update | ||
public float speed = 1f; | ||
public GameObject player = GameObject.Find("Player"); | ||
// public Vector2 playerSpot; | ||
public Vector2 enemySpot; | ||
public float distance; | ||
|
||
public GameObject projectile; | ||
|
||
public Transform player2; | ||
// Use this for initialization | ||
void Start() | ||
{ | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
//rotate to look at the player | ||
transform.LookAt(target.position); | ||
transform.Rotate(new Vector3(0, -90, 0), Space.Self);//correcting the original rotation | ||
|
||
|
||
//move towards the player | ||
if (Vector3.Distance(transform.position, target.position) > 3f) | ||
{//move if distance from target is greater than 1 | ||
transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0)); | ||
if (ammo > 0) | ||
{ | ||
GameObject spawn = Instantiate(projectile, new Vector2(transform.position.x, transform.position.y), Quaternion.Euler(0, 0, 0)) as GameObject; | ||
ammo = ammo - 1; | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class LargeArcher : MonoBehaviour { | ||
public int ammo = 10; | ||
|
||
public Transform target;//set target from inspector instead of looking in Update | ||
public float speed = 1f; | ||
public GameObject player = GameObject.Find("Player"); | ||
// public Vector2 playerSpot; | ||
public Vector2 enemySpot; | ||
public float distance; | ||
|
||
public GameObject projectile; | ||
|
||
public Vector2 backupPos = new Vector2(7,7); | ||
|
||
public Transform player2; | ||
// Use this for initialization | ||
void Start() | ||
{ | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
//rotate to look at the player | ||
transform.LookAt(target.position); | ||
transform.Rotate(new Vector3(0, -90, 0), Space.Self);//correcting the original rotation | ||
|
||
|
||
//move towards the player | ||
if (Vector3.Distance(transform.position, target.position) > 3f) | ||
{//move if distance from target is greater than 1 | ||
transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0)); | ||
if (ammo > 0) | ||
{ | ||
GameObject spawn = Instantiate(projectile, new Vector2(transform.position.x, transform.position.y), Quaternion.Euler(0, 0, 0)) as GameObject; | ||
ammo = ammo - 1; | ||
} | ||
|
||
} | ||
//if (Vector3.Distance(transform.position, target.position) < 2f) | ||
//{ | ||
// transform.Translate(new Vector3(speed * Time.deltaTime, 7, 7)); | ||
|
||
//} | ||
//if (Vector3.Distance(transform.position, target.position) > 7f) | ||
//{ | ||
// ammo = 10; | ||
//} | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class LargeRobot : MonoBehaviour { | ||
|
||
public Transform target;//set target from inspector instead of looking in Update | ||
public float speed = 1f; | ||
public GameObject player = GameObject.Find("Player"); | ||
// public Vector2 playerSpot; | ||
public Vector2 enemySpot; | ||
public float distance; | ||
|
||
public Transform player2; | ||
// Use this for initialization | ||
void Start() | ||
{ | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update() | ||
{ | ||
//rotate to look at the player | ||
transform.LookAt(target.position); | ||
transform.Rotate(new Vector3(0, -90, 0), Space.Self);//correcting the original rotation | ||
|
||
|
||
//move towards the player | ||
if (Vector3.Distance(transform.position, target.position) > 2f) | ||
{//move if distance from target is greater than 1 | ||
transform.Translate(new Vector3(speed * Time.deltaTime, 0, 0)); | ||
} | ||
|
||
|
||
|
||
|
||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using UnityEngine; | ||
using System.Collections; | ||
|
||
public class MenuScript : MonoBehaviour { | ||
|
||
// Use this for initialization | ||
void Start () { | ||
|
||
} | ||
|
||
// Update is called once per frame | ||
void Update () { | ||
|
||
} | ||
|
||
public void StartGame() | ||
{ | ||
Application.LoadLevel(1); | ||
} | ||
public void ControlMenu() | ||
{ | ||
Application.LoadLevel(2); | ||
} | ||
public void ReturnToMenu() | ||
{ | ||
Application.LoadLevel(0); | ||
} | ||
|
||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.