void HandleFiring() { if (secondsToNextCannon > 0) { secondsToNextCannon -= Time.deltaTime; } if (secondsToNextCannon <= 0 && (Input.GetKey(KeyCode.Space) || Input.GetMouseButton(0) || IsHaywireActive(HaywireType.ShipCannonsNonStop))) { CannonBehaviour currentCannon = cannons[nextCannon]; bool backwards = IsHaywireActive(HaywireType.ShipCannonsBackwards); bool weighted = IsHaywireActive(HaywireType.ShipProjectilesWeighted); currentCannon.FireCannon(backwards, weighted); secondsToNextCannon = GetCannonCooldownTime(); nextCannon += 1; if (nextCannon >= cannons.Count) { nextCannon = 0; } } }
public void Awake() { if (player_cannon_ == true) { player_ = this; } }
void setObjectToWorld() { foreach (Transform child in wand) { spawnedObject = child.transform; } spawnedObject.parent = world; if (spawnedObject.tag == "footsoldiers") { spawnedObject.localScale = new Vector3(1.5f, 1.5f, 1.5f); spawnedObject.gameObject.AddComponent<Rigidbody>(); spawnedObject.gameObject.AddComponent("SoldierMovement"); spawnedObject.rigidbody.constraints = RigidbodyConstraints.FreezeRotationX; spawnedObject.position = new Vector3 (spawnedObject.position.x, world.position.y, spawnedObject.position.z); soldierMovementHandler = spawnedObject.gameObject.GetComponent("SoldierMovement") as SoldierMovement; soldierMovementHandler.notifyArchers(); } if (spawnedObject.tag == "trebuchet") { spawnedObject.localScale = new Vector3(1.3f, 1.3f, 1.3f); spawnedObject.position = new Vector3 (spawnedObject.position.x, world.position.y + 0.7f, spawnedObject.position.z); spawnedObject.gameObject.AddComponent("CannonBehaviour"); cannonBehaviour = spawnedObject.gameObject.GetComponent("CannonBehaviour") as CannonBehaviour; cannonBehaviour.notifyArchers(); } }
private void MakeRain() { //activate cannon here //move cannon to point b, start timer //if < 2s and hit, move to point a and fire case 2 else >= 2s fire case 1 //cannon goes back as it rains //case 1 rain without red object, case 2 rain with red object and Fallen() CannonBehaviour cannonBehaviour = cannon.GetComponent <CannonBehaviour>(); cannonBehaviour.Move(); }
protected override void HandleFiring() { if (targetPlayer != null) { if (secondsToNextCannon > 0) { secondsToNextCannon -= Time.deltaTime; } if (secondsToNextCannon <= 0) { CannonBehaviour currentCannon = cannons[nextCannon]; currentCannon.FireCannon(true); secondsToNextCannon = cannonCooldownTime + (Random.Range(0, 0.50f) * cannonCooldownTime); nextCannon += 1; if (nextCannon >= cannons.Count) nextCannon = 0; } } }
// Use this for initialization void Start() { vidaAtual = vidaTotal; col = GetComponent <CapsuleCollider>(); barraVida.fillAmount = vidaAtual / vidaTotal; // agente = GetComponent<NavMeshAgent>(); anim = GetComponent <Animator>(); auxSpawn = GameObject.Find("Spawn").GetComponent <Spawn>(); auxCannon = GameObject.Find("Buster").GetComponent <CannonBehaviour>(); path[0] = GameObject.Find("Path1"); path[1] = GameObject.Find("Path2"); path[2] = GameObject.Find("Path3"); path[3] = GameObject.Find("Path4"); indexpath = Random.Range(0, 4); agente.SetDestination(path[0].transform.GetChild(indexpath).position); }
private void CallCannon(){ CannonBehaviour cannonScript = cannon.GetComponent<CannonBehaviour>(); if(reset){ cannonScript.waypointIndex = 1; cannonScript.cannonTimeStamp = 0.0f; cannonScript.cannonDmg = false; cannonScript.bossDmg = false; reset = false; } cannonScript.Move(); if(cannonScript.bossDmg && bossTimer > 15.0f){ bossHit = true; } else { if(bossTimer > 15.0f){ ResetBoss(); } } }
// Use this for initialization void Start() { auxCannon = GameObject.Find("Buster").GetComponent <CannonBehaviour>(); }
void Start() { cannon_behaviour_ = cannon_.GetComponentInChildren <CannonBehaviour>(); timer_ = cooldown_ + Random.Range(-1.0f, 1.0f); }
void Start() { cannon_behaviour_ = cannon_.GetComponentInChildren<CannonBehaviour>(); timer_ = cooldown_ + Random.Range(-1.0f, 1.0f); }