예제 #1
0
    //---------------------------------------------------------------
    void Update()
    {
        if (WinLoseCondition.GetIsGameOver() == true)
        {
            return;
        }

        if (EnemyWaveController.GetWaveHasStarted())
        {
            if (bBeingSilenced)
            {
                silencedTime -= Time.deltaTime;
                if (silencedTime <= 0)
                {
                    SpriteRenderer renderer = transform.GetChild(0).GetComponent <SpriteRenderer>();
                    renderer.color = Color.white;
                    bBeingSilenced = false;
                }
                return;
            }

            //cooldown skill over time
            skillCoolDownTime = skillCoolDownTime - Time.deltaTime;

            //visualize cooldown status
            SetSkillBar();

            if (skillCoolDownTime <= 0)
            {
                if (bIsAutoSkill)
                {
                    CastAutoPlaySkill();
                }
                else
                {
                    //Display shootable notification
                    ToggleShootableNotif(true);
                }
            }
        }

        if (bIsSkillCastEffectShowing)
        {
            //if Wave UI Text is displayed while gauge is displayed
            if (UITextController.GetUITextStatusType() == UITextController.DISPLAY_TEXT.WAVE)
            {
                if (bIsShootingSkill)
                {
                    Destroy(GameObject.FindObjectOfType <GaugeMeter>().gameObject); //hide the gauge (destroying it)
                }

                tapTimes = 0;                      //reset the tap times
                bIsSkillCastEffectShowing = false; //the flag telling the gauge is NOT displayed to shot skill
                Prisoner.UnSetPrisonIsCasting();   //the flag telling prisoner is NOT about to shot skill
                return;
            }

            //Only support skills can be activated right on the adjusting time
            CastSupportSkillWhenAdjTimeIs(true);

            needleAdjustTime = needleAdjustTime - Time.unscaledDeltaTime;

            Prisoner.SetPrisonIsCasting();
            if (needleAdjustTime <= 0)
            {
                //TODO refactor this
                //Unpause to shoot
                Time.timeScale = 1;
                skillCastingEffect.EndEffect();
                ExitStandOut();

                if (!bIsSkillUsedThisCharge)
                {
                    //if the skill is the shooting skill
                    if (bIsShootingSkill)
                    {
                        SkillShootingFromNeedle();
                        // else if the skill is the supporting skill
                    }
                    else
                    {
                        CastSupportSkillWhenAdjTimeIs(false);
                    }
                }

                bIsSkillCastEffectShowing = false;
                needleAdjustTime          = maxAdjustTime;
                Prisoner.UnSetPrisonIsCasting();
                prisonerJustUsedSkill = this.gameObject;
                FindNotYetSkillUsersToDelaySkill();
                pausingForSkill = false;
                PlayerPrefManager.SetUITextStatus(PlayerPrefManager.GUITEXT_STATUS_CHANGING);
                UITextController.SetUITextStatusType(UITextController.DISPLAY_TEXT.SKILL_NAME, playingSkillName);
            }
        }
    }