Beispiel #1
0
    private void OnEnter(Player pPlayer)
    {
        switch (type)
        {
        case EType.Weapon:
            MapWeaponConfig weapon = GetMapWeaponConfig();
            pPlayer.ItemController.AddMapWeapon(weapon.Id);
            break;

        case EType.SpecialWeapon:
            MapSpecialWeaponConfig specialWeapon = GetMapSpecialWeaponConfig();
            pPlayer.ItemController.AddMapWeaponSpecial(specialWeapon.Id);
            break;

        case EType.PowerUp:
            PowerUpConfig powerUpConfig = GetPowerUpConfig();
            PowerupManager.HandlePowerup(powerUpConfig, pPlayer);
            break;

        case EType.GameEffect:
            GameEffectConfig config = GetGameEffectConfig();
            game.GameEffect.HandleEffect(config.Type);
            break;

        default:
            Debug.LogError("Map item type not handled");
            break;
        }
        PlaySound(ESound.Item_Weapon_Pickup);

        //if(powerUpConfig != null)
        //{
        //	//Debug.Log("OnEnter powerup");
        //	PowerupManager.HandlePowerup(powerUpConfig, pPlayer);
        //}
        //else if(weaponConfig != null)
        //{
        //	//Debug.Log("OnEnter weapon");
        //	pPlayer.ItemController.AddMapWeapon(weaponConfig.Id);
        //	PlaySound(ESound.Item_Weapon_Pickup);
        //}
        //else if(weaponSpecialConfig != null)
        //{
        //	//Debug.Log("OnEnter weapon special");
        //	pPlayer.ItemController.AddMapWeaponSpecial(weaponSpecialConfig.Id);
        //	PlaySound(ESound.Item_Weapon_Pickup);
        //}
        //TODO: special weapon + handle error

        ReturnToPool();
    }