Exemplo n.º 1
0
    public void CmdActivate(GameObject player)
    {
        ObjectCollisionHandler playerCollisionHandler = player.GetComponent <ObjectCollisionHandler>();
        PlayerWeapons          playerWeapons          = player.GetComponent <PlayerWeapons>();

        if (healthDef.activated)
        {
            if (healthDef.increaseMax)
            {
                playerCollisionHandler.maxHealth += healthDef.amount;
            }
            playerCollisionHandler.AddHealth(healthDef.amount);
        }
        if (energyDef.activated)
        {
            if (energyDef.increaseMax)
            {
                playerWeapons.maxEnergy += energyDef.amount;
            }
            playerWeapons.AddEnergy(energyDef.amount);
        }
        if (changeWeaponDef.activated)
        {
            playerWeapons.ChangeWeapon(changeWeaponDef.weaponType, true);
        }
        if (changeMissileDef.activated)
        {
            playerWeapons.ChangeMissile(changeMissileDef.missileType, changeMissileDef.amount, true);
        }
        if (spawnObjectDef.activated)
        {
            Pools.Initialize(spawnObjectDef.objectToSpawn, transform.position, Quaternion.identity);
        }
        if (spawnTurretDef.activated)
        {
            playerWeapons.AddTurret(1);
        }
        if (spawnGunDef.activated)
        {
            playerWeapons.AddGuns(1);
        }
    }