예제 #1
0
    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);
        }
    }
예제 #2
0
 /// <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());
     }
 }
예제 #3
0
 /// <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());
     }
 }
예제 #4
0
 void Awake()
 {
     if (FindObjectsOfType(GetType()).Length > 1)
     {
         DestroyImmediate(gameObject);
         return;
     }
     instance = this;
 }
예제 #5
0
    /// <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;
    }
예제 #6
0
 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();
 }
예제 #7
0
 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;
 }
예제 #8
0
 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;
 }
예제 #9
0
    /// <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);
    }
예제 #10
0
    // 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;
    }
예제 #11
0
        public void FindReferences()
        {
            var referenceManager = GlobalReferenceManager.ReferenceManager;

            keyboardInputManager = referenceManager.keyboardInputManager;
            coolDownTimer        = new CoolDownTimer
            {
                tickRate = fireRate,
            };
            foundReferences = true;
        }
예제 #12
0
    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";
    }
예제 #13
0
        /// <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();
        }
예제 #14
0
    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);
        }
    }
예제 #15
0
    // 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>();
    }
예제 #16
0
 /// <summary>
 /// Hàm xử lý kết thúc game
 /// </summary>
 public void EndGame()
 {
     CoolDownTimer.Stop();
     panelBoard.Enabled = false;
 }
예제 #17
0
 private void newGameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     CoolDownTimer.Stop();
     NewGame();
     socket.Send(new SocketData((int)SocketCommand.NEW_GAME, ""));
 }
예제 #18
0
 // Start is called before the first frame update
 void Start()
 {
     coolDownTimer = transform.parent.GetComponentInChildren <CoolDownTimer>();
 }
예제 #19
0
 public Beam(Player _player)
 {
     player = _player;
     akd    = new CoolDownTimer(AbilityUtils.BeamCD);
 }
예제 #20
0
    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);
        }
    }
예제 #21
0
 public void SwitchIcons(CoolDownTimer from, CoolDownTimer to)
 {
     from.GetComponent <Image>().enabled = false;
     to.GetComponent <Image>().enabled   = true;
 }
예제 #22
0
 public void EnableIcon(CoolDownTimer icon)
 {
     icon.GetComponent <Image>().enabled = true;
 }
예제 #23
0
 public Stab(Player _player)
 {
     player = _player;
     akd    = new CoolDownTimer(AbilityUtils.StabCD);
 }
예제 #24
0
 public Spin(Player _player)
 {
     player = _player;
     akd    = new CoolDownTimer(AbilityUtils.SpinCD);
 }
예제 #25
0
 public WarriorBoost(Player _player)
 {
     player = _player;
     akd    = new CoolDownTimer(AbilityUtils.WarriorBoostCD);
 }
예제 #26
0
 static int SortByCoolDown(CoolDownTimer coolDown1, CoolDownTimer coolDown2)
 {
     return(coolDown1.cooldown.cd.CompareTo(coolDown2.cooldown.cd));
 }