Beispiel #1
0
    private void GivePlayerPowerup(POWERTYPES a_ePowerType)
    {
        CS_FirstPersonController playerRef = GetComponent <CS_FirstPersonController>();

        switch (a_ePowerType)
        {
        case POWERTYPES.DAMAGEUP:
        {
            Debug.Log("DAMAGEUP");

            fPowerOldDamage = playerRef.GetDamage();
            playerRef.SetDamage(50);
            playerRef.SetText("INCREASE DAMAGE");
            break;
        }

        case POWERTYPES.HEALTHUP:
        {
            Debug.Log("HEALTHUP");
            playerRef.SetText("HEALTH");

            fPowerOldHealth = playerRef.GetHealth();
            playerRef.SetHealth(180);
            break;
        }

        case POWERTYPES.INVINCIBILITY:
        {
            Debug.Log("INVINCIBILITY");
            playerRef.SetText("INVINCIBILITY");

            fPowerOldHealth    = playerRef.GetHealth();
            fPowerOldMaxHealth = playerRef.GetMaxHealth();

            playerRef.SetMaxHealth(1000);
            playerRef.SetHealth(999);


            break;
        }

        case POWERTYPES.SPEEDUP:
        {
            Debug.Log("SPEEDUP");
            playerRef.SetText("SPEED UP");

            fPowerOldSpeed = playerRef.GetWalkSpeed();
            playerRef.SetWalkSpeed(15);

            break;
        }
        }
    }
Beispiel #2
0
    private void TakePlayerPowerup(POWERTYPES a_ePowerType)
    {
        CS_FirstPersonController playerRef = GetComponent <CS_FirstPersonController>();

        switch (a_ePowerType)
        {
        case POWERTYPES.DAMAGEUP:
        {
            Debug.Log("DAMAGEUP");

            playerRef.SetDamage((int)fPowerOldDamage);        //hey bby
            break;
        }

        case POWERTYPES.HEALTHUP:
        {
            Debug.Log("HEALTHUP");


            playerRef.SetHealth((int)fPowerOldHealth);
            break;
        }

        case POWERTYPES.INVINCIBILITY:
        {
            Debug.Log("INVINCIBILITY");
            playerRef.SetHealth((int)fPowerOldHealth);
            playerRef.SetMaxHealth((int)fPowerOldMaxHealth);



            break;
        }

        case POWERTYPES.SPEEDUP:
        {
            Debug.Log("SPEEDUP");


            GetComponent <CS_FirstPersonController>().SetWalkSpeed((int)fPowerOldSpeed);

            break;
        }
        }
    }