示例#1
0
    //Uses the player's Active
    private void UseActive()
    {
        if (currentActive == null)
        {
            switch (currentActiveType)
            {
                case Active.ActiveType.GravField:
                    currentActive = ActivesTypes.GravityField(this);
                    break;
                case Active.ActiveType.Reflect:
                    currentActive = ActivesTypes.Reflect(this);
                    break;
                case Active.ActiveType.SlipGel:
                    currentActive = ActivesTypes.Slipstream(this);
                    break;
                case Active.ActiveType.Soak:
                    currentActive = ActivesTypes.Soak(this);
                    break;
                case Active.ActiveType.Overclock:
                    currentActive = ActivesTypes.Overclock(this);
                    break;
                case Active.ActiveType.SlowGel:
                    currentActive = ActivesTypes.Slowstream(this);
                    break;
            }

            if (currentActive != null)
            {
                currentActive.UseActive();

                currentActive.Duration.OnTimerComplete += OnActiveDurationEnded;

                if (currentActiveType == Active.ActiveType.Reflect) //Disable collision while Reflect is active.
                {
                    gameObject.GetComponent<Rigidbody2D>().drag = 250; //Well we can't disable collision for a while sooooo crank drag the f**k up.
                }

                //Show the Cooldown overlay on the HUD
                if (Player_Cooldown_Start != null)
                    Player_Cooldown_Start(PlayerNumber);
            }
        }
    }