コード例 #1
0
ファイル: FireBall.cs プロジェクト: The-GameDJs/CostumeCurse
        private void StartFireballPhase()
        {
            this.CurrentPhase = FireballPhase.Growth;

            Fireball.SetActive(true);
            Fireball.transform.position   = transform.position + FireballHeight * Vector3.up;
            Fireball.transform.localScale = Vector3.one * FireballScale;
            MainModule.startColor         = Color.red;
            LightSource.color             = Color.red;
            LightSource.intensity         = 15.0f;

            ExpectedDirections = new List <ExpectedDirection>
            {
                ExpectedDirection.Up,
                ExpectedDirection.Right,
                ExpectedDirection.Down,
                ExpectedDirection.Left
            };

            CurrentCyclePhase = FireballCyclePhase.Normal;

            Timer.StartTimer(Random.Range(FireballGrowthMinDuration, FireballGrowthMaxDuration));
        }
コード例 #2
0
ファイル: FireBall.cs プロジェクト: The-GameDJs/CostumeCurse
        private void FireballUpdate()
        {
            float t = 1 / (Mathf.PI / 2) * Mathf.Atan(FireballScalingElapsedTime / FireballScalingSmoothness);

            Fireball.transform.localScale = Vector3.Lerp(
                Fireball.transform.localScale,
                Vector3.one * TargetFireballSize,
                t);
            FireballScalingElapsedTime += Time.deltaTime;

            if (Timer.IsInProgress())
            {
                float progress = Timer.GetProgress();

                if (IsFireballKeyDown())
                {
                    if (CurrentCyclePhase == FireballCyclePhase.Unstable)
                    {
                        ShrinkFireball();
                        return;
                    }


                    var currentKey = ExpectedDirections[0];

                    switch (currentKey)
                    {
                    case ExpectedDirection.Up:
                        if (Input.GetButtonDown("Right") || Input.GetButtonDown("Down") || Input.GetButtonDown("Left"))
                        {
                            ShrinkFireball();
                        }
                        else
                        {
                            GrowFireball();
                        }
                        break;

                    case ExpectedDirection.Down:
                        if (Input.GetButtonDown("Left") || Input.GetButtonDown("Up") || Input.GetButtonDown("Right"))
                        {
                            ShrinkFireball();
                        }
                        else
                        {
                            GrowFireball();
                        }
                        break;

                    case ExpectedDirection.Right:
                        if (Input.GetButtonDown("Down") || Input.GetButtonDown("Left") || Input.GetButtonDown("Up"))
                        {
                            ShrinkFireball();
                        }
                        else
                        {
                            GrowFireball();
                        }
                        break;

                    case ExpectedDirection.Left:
                        if (Input.GetButtonDown("Up") || Input.GetButtonDown("Right") || Input.GetButtonDown("Down"))
                        {
                            ShrinkFireball();
                        }
                        else
                        {
                            GrowFireball();
                        }
                        break;

                    default:
                        break;
                    }
                }
            }

            else if (Timer.IsFinished())
            {
                if (CurrentFireballCycle == FireballCycles &&
                    CurrentCyclePhase == FireballCyclePhase.Normal)
                {
                    CurrentDamage += (int)EvaluateFireballDamage();
                    Debug.Log(CurrentDamage);
                    EndAbility();
                    return;
                }

                if (CurrentCyclePhase == FireballCyclePhase.Normal)
                {
                    CurrentCyclePhase = FireballCyclePhase.UnstableWarning;
                    Timer.StartTimer(FireballUnstablingWarningDuration);
                    MainModule.startColor = Color.yellow;
                    LightSource.color     = Color.yellow;
                    return;
                }

                if (CurrentCyclePhase == FireballCyclePhase.UnstableWarning)
                {
                    CurrentCyclePhase = FireballCyclePhase.Unstable;
                    Timer.StartTimer(FireballUnstableDuration);
                    MainModule.startColor = Color.white;
                    LightSource.color     = Color.white;
                    return;
                }

                if (CurrentCyclePhase == FireballCyclePhase.Unstable)
                {
                    CurrentFireballCycle += 1;
                    CurrentCyclePhase     = FireballCyclePhase.Normal;
                    MainModule.startColor = Color.red;
                    LightSource.color     = Color.red;

                    Timer.StartTimer(Random.Range(FireballGrowthMinDuration, FireballGrowthMaxDuration));
                    return;
                }
            }
        }