void RemoveBonus() { int idx = -1; foreach (Bonus b in bonusList) { if (b.isDisappear == true) { idx = bonusList.IndexOf(b); Destroy(b.gameObject); score += 10; } } if (idx >= 0) { bonusList.RemoveAt(idx); //cdBaseCoolTimer = cdBaseCool; CoolDownTimer cdt = Instantiate(coolDownTimer); cdt.coolDown = CDBONUS; cdt.t = 1; //cdt.t = "base"; //cdt.coolDownTimer = 20.0f; cdt.StartCD(); //cdt.type = "base"; cdTimerList.Add(cdt); } }
/// <summary> /// Ensures the timer routine is stopped, resets it, and restarts it /// </summary> /// <param name="timer"></param> public void ResumeTimer(CoolDownTimer timer) { // Restart timer where it was if (timer != null && !timer.IsRunning) { StartCoroutine(timer.TimerRoutine()); } }
/// <summary> /// Stops the coroutine for the timer so that it no longer increases /// However, it does keep its current state so that it can be resumed /// </summary> /// <param name="timer"></param> public void PauseTimer(CoolDownTimer timer) { if (timer != null && timer.IsRunning) { timer.StopTimer(); StopCoroutine(timer.TimerRoutine()); } }
void Awake() { if (FindObjectsOfType(GetType()).Length > 1) { DestroyImmediate(gameObject); return; } instance = this; }
/// <summary> /// Creates and binds the cooldown timers /// Does not start them as this is controlled by the unit /// </summary> protected virtual void SetupTimers() { // Creates default timers m_attackTimer = new CoolDownTimer(Stats[RateId.Attack]); m_specialTimer = new CoolDownTimer(Stats[RateId.Special]); m_attackTimer.OnTimerCompletedAction = AttackAction; m_specialTimer.OnTimerCompletedAction = SpecialAction; }
private void Gh_EClickedButton(object sender, ButtonClickEvent e) { CoolDownTimer.Start(); panelBoard.Enabled = false; pbCoolDown.Value = 0; socket.Send(new SocketData((int)SocketCommand.SEND_POINT, "", e.ClickedPoint)); isPlaying = false; Listen(); }
public Tower(int x, int y, float iAttackCooldown, int iHotkeyNumber) { _x = x; _y = y; _attackTimer = new CoolDownTimer(iAttackCooldown); _attackTimer.Reset(); _attackTimer.SecondsElapsed = iAttackCooldown / 2; TowerInfo = "undefined"; HotkeyNumber = iHotkeyNumber; }
public Tower(int iX, int iY, float iAttackCooldown, int iHotkeyNumber) { _x = iX; _y = iY; attackTimer = new CoolDownTimer(iAttackCooldown); attackTimer.Reset(); attackTimer.SecondsElapsed = iAttackCooldown / 2; towerInfo = "undefined"; HotkeyNumber = iHotkeyNumber; }
/// <summary> /// Ensures the timer routine is stopped and then resets it /// Timer gets stated by the AIManager or the unit that called it /// </summary> /// <param name="timer"></param> protected virtual void ResetTimer(CoolDownTimer timer) { if (timer.IsRunning) { AIManager.instance.PauseTimer(timer); } timer.ResetTimer(); AIManager.instance.ResumeTimer(timer); }
// Start is called before the first frame update void Start() { controller = GetComponent <CharacterController>(); rg = GetComponent <Rigidbody>(); m_EulerAngleVelocity = new Vector3(0, 10, 0); //animator.SetBool("isGrounded", true); //animator.SetBool("isAlive", true); attackTimer = Instantiate(coolDownTimer); attackTimer.coolDown = 3.0f; }
public void FindReferences() { var referenceManager = GlobalReferenceManager.ReferenceManager; keyboardInputManager = referenceManager.keyboardInputManager; coolDownTimer = new CoolDownTimer { tickRate = fireRate, }; foundReferences = true; }
void Start() { heatTimerObject = Instantiate (heatTimerObject) as GameObject; freezeTimerObject = Instantiate (freezeTimerObject) as GameObject; heatTime = heatTimerObject.GetComponent<CoolDownTimer> () as CoolDownTimer; freezeTime = freezeTimerObject.GetComponent<CoolDownTimer> () as CoolDownTimer; heatTimerObject.transform.parent = this.transform; freezeTimerObject.transform.parent = this.transform; heatTimerObject.name = "Heat Timer"; freezeTimerObject.name = "Freeze Timer"; }
/// <summary> /// Xử lý gói dữ liệu dạng SocketData /// </summary> /// <param name="data"></param> private void DataHandling(SocketData data) { switch (data.Command) { case (int)SocketCommand.NOTIFY: break; case (int)SocketCommand.NEW_GAME: this.Invoke((MethodInvoker)(() => { NewGame(); panelBoard.Enabled = false; CoolDownTimer.Stop(); })); break; case (int)SocketCommand.SEND_POINT: this.Invoke((MethodInvoker)(() => { pbCoolDown.Value = 0; panelBoard.Enabled = true; CoolDownTimer.Start(); gh.OtherPlayerMark(data.Point); })); break; //case (int)SocketCommand.END_GAME: // MessageBox.Show("Bạn đã thua"); // break; case (int)SocketCommand.TIME_OUT: EndGame(); MessageBox.Show("Bạn đã thắng!"); break; case (int)SocketCommand.QUIT: CoolDownTimer.Stop(); MessageBox.Show("Đối thủ đã thoát ra!"); break; default: break; } Listen(); }
void SpawnZombie() { int idx = -1; foreach (LatentCreature c in latentCreatureList) { GameObject cube = c.transform.Find("Cube").gameObject; if (c.spawnCreature == true) { Zombie z = Instantiate(initialZombie); z.transform.position = c.transform.position; zombieList.Add(z); c.spawnCreature = false; idx = latentCreatureList.IndexOf(c); Destroy(c.gameObject); } } if (idx >= 0) { latentCreatureList.RemoveAt(idx); CoolDownTimer cdt = Instantiate(coolDownTimer); cdt.coolDown = CDBASE; cdt.t = 0; cdt.StartCD(); cdTimerList.Add(cdt); } }
// Start is called before the first frame update void Start() { //Time.timeScale = 1; //player = transform.Find("Player").gameObject; Vector3 pos = new Vector3(100, 0, 100); initialZombie.transform.position = pos; Instantiate(initialZombie); zombieList.Add(initialZombie); SpawnBonus(); SpawnBase(); CD_deltaScore = Instantiate(coolDownTimer); CD_deltaScore.coolDown = DOUBLETIME; CD_deltaScore.StartCD(); CD_score = Instantiate(coolDownTimer); CD_score.coolDown = SCORETIME; CD_score.StartCD(); MSG = transform.Find("Canvas/MSG") as RectTransform; //MSG.gameObject.SetActive(false); text_fail = transform.Find("Canvas/MSG/Text").GetComponent <Text>(); text_lives = transform.Find("Canvas/HUD/Left/Text").GetComponent <Text>(); text_scores = transform.Find("Canvas/HUD/Center/Text").GetComponent <Text>(); text_enemies = transform.Find("Canvas/HUD/Right/Text").GetComponent <Text>(); text_time = transform.Find("Canvas/HUD/LeftColumn/Timer/Text").GetComponent <Text>(); }
/// <summary> /// Hàm xử lý kết thúc game /// </summary> public void EndGame() { CoolDownTimer.Stop(); panelBoard.Enabled = false; }
private void newGameToolStripMenuItem_Click(object sender, EventArgs e) { CoolDownTimer.Stop(); NewGame(); socket.Send(new SocketData((int)SocketCommand.NEW_GAME, "")); }
// Start is called before the first frame update void Start() { coolDownTimer = transform.parent.GetComponentInChildren <CoolDownTimer>(); }
public Beam(Player _player) { player = _player; akd = new CoolDownTimer(AbilityUtils.BeamCD); }
void CastSpell(GameObject prefab, ref float timer, float cooldown, bool unlocked, string trigger, CoolDownTimer icon) { if (Time.time > timer && unlocked) { timer = Time.time + cooldown; var spell = Instantiate(prefab).GetComponent <Ability>(); spell.Init(this); animator.SetTrigger(trigger); icon.Spin(cooldown); } }
public void SwitchIcons(CoolDownTimer from, CoolDownTimer to) { from.GetComponent <Image>().enabled = false; to.GetComponent <Image>().enabled = true; }
public void EnableIcon(CoolDownTimer icon) { icon.GetComponent <Image>().enabled = true; }
public Stab(Player _player) { player = _player; akd = new CoolDownTimer(AbilityUtils.StabCD); }
public Spin(Player _player) { player = _player; akd = new CoolDownTimer(AbilityUtils.SpinCD); }
public WarriorBoost(Player _player) { player = _player; akd = new CoolDownTimer(AbilityUtils.WarriorBoostCD); }
static int SortByCoolDown(CoolDownTimer coolDown1, CoolDownTimer coolDown2) { return(coolDown1.cooldown.cd.CompareTo(coolDown2.cooldown.cd)); }