using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; public class ShootingCannon : ActiveBlock { public bool shootingRight; public GameObject shootingObject; public Transform spawnLocation; public TextMeshPro counter; public int countdowntimer; int countdown; public override int GetInitative() { //order return 4; } private void Start() { countdown = countdowntimer; } private void Update() { counter.text = countdown.ToString(); } public override IEnumerator OnEnvironmentTurn(PlayerData[] allPlayers) { countdown--; if (countdown == 0) { GameObject shot = Instantiate(shootingObject, spawnLocation.position, Quaternion.identity); if (shootingRight == true){ shot.GetComponent().AddForce(shot.transform.forward * -500); }else{ shot.GetComponent().AddForce(shot.transform.forward * 500); } countdown = countdowntimer; } isFinished = true; yield break; } }