// Update is called once per frame protected new void Update() { if (Input.GetMouseButtonDown(0) && Time.time > Player.Instance.next_fire && scene_controller.status) { Bullet bullet = Player.Instance.shoot(); ShootingAction sa = ShootingAction.GetAction(bullet.speed); sa.type = 1; RunAction(bullet.getBullet(), sa, this); Player.Instance.next_fire += Player.Instance.fire_rate * Time.deltaTime; } if (Time.time > ClayPigeonFirer.Instance.next_fire && !scene_controller.isGameOver) { ClayPigeonFirer.Instance.transform.LookAt(new Vector3(7, Random.Range(1, 10), Random.Range(6, 15))); ClayPigeon clayPigeon = ClayPigeonFirer.Instance.fireClayPigeon(RoundController.Instance); ShootingAction sa = ShootingAction.GetAction(clayPigeon.speed); sa.type = 1; RunAction(clayPigeon.getClayPigeon(), sa, this); ClayPigeonFirer.Instance.next_fire += ClayPigeonFirer.Instance.fire_rate * Time.deltaTime; } base.Update(); }
public ClayPigeon fireClayPigeon(RoundController current_round) { ClayPigeon clay_pigeon; if (free.ToArray().Length == 0) { clay_pigeon = new ClayPigeon(); GameObject horse = Instantiate(Resources.Load("Horse")) as GameObject; horse.AddComponent <Rigidbody> (); horse.GetComponent <Rigidbody> ().useGravity = false; clay_pigeon.setGameObject(horse); this.free.Add(clay_pigeon); } int round = current_round.current_round; clay_pigeon = this.free[0]; clay_pigeon.setClayPigeon(10 + round / 10, round / 10, round > 10 ? Random.Range(1, 2) : 0, this.transform); used.Add(clay_pigeon); free.Remove(clay_pigeon); current_round.rest--; return(clay_pigeon); }
public ClayPigeon fireClayPigeon(RoundController current_round) { ClayPigeon clay_pigeon; if (free.ToArray().Length == 0) { clay_pigeon = new ClayPigeon(); GameObject horse = Instantiate(Resources.Load("Horse")) as GameObject; horse.AddComponent <Rigidbody> (); horse.GetComponent <Rigidbody> ().useGravity = false; Animator anima = horse.GetComponent <Animator> (); anima.SetInteger("isFree", 0); clay_pigeon.setGameObject(horse); this.free.Add(clay_pigeon); } next_fire += fire_rate * Time.deltaTime; int round = current_round.current_round; clay_pigeon = this.free[0]; clay_pigeon.setClayPigeon(10 + round / 10, round / 10, round > 10 ? Random.Range(1, 2) : 0, this.transform); used.Add(clay_pigeon); current_round.rest--; return(clay_pigeon); }
public void recollectClayPigeon(ClayPigeon clay_pigeon) { this.used.Remove(clay_pigeon); this.free.Add(clay_pigeon); clay_pigeon.beCollect(); }