Exemplo n.º 1
0
    private void RefreshMapSprite()
    {
        Sprite s = null;

        switch (type)
        {
        case EType.Weapon:
            MapWeaponConfig weapon = GetMapWeaponConfig();
            s = weapon.MapItemInfo.MapSprite;
            break;

        case EType.SpecialWeapon:
            MapSpecialWeaponConfig specialWeapon = GetMapSpecialWeaponConfig();
            s = specialWeapon.MapItemInfo.MapSprite;
            break;

        case EType.PowerUp:
            PowerUpConfig powerUpConfig = GetPowerUpConfig();
            s = powerUpConfig.MapItemInfo.MapSprite;
            break;

        case EType.GameEffect:
            GameEffectConfig config = GetGameEffectConfig();
            s = config.MapItemInfo.MapSprite;
            break;

        default:
            Debug.LogError("Map item type not inited");
            break;
        }

        spriteRend.sprite = s;
    }
Exemplo n.º 2
0
    public static void HandlePowerup(PowerUpConfig pConfig, Player pPlayer)
    {
        //EPowerUp type = pConfig.Type;
        //Debug.Log($"HandlePowerup {type} for {pPlayer}");

        string statusMessage = ApplyPowerup(pConfig, pPlayer);

        //show status
        Game.Instance.PlayerStatusManager.ShowStatus(pPlayer.Stats.MapItemUiPosition.position,
                                                     statusMessage.Length > 0 ? statusMessage : pConfig.MapItemInfo.StatusText,
                                                     pConfig.MapItemInfo.StatusSprite);
    }
Exemplo n.º 3
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();
    }
    public PowerUpConfig GetNextPowerUp(PowerUpConfig currentOne)
    {
        int currentIndex = m_powerUpProgression.IndexOf(currentOne);

        if (currentIndex == -1)
        {
            Debug.LogError("Current config not found in progression");
            return(null);
        }
        if (currentIndex == m_powerUpProgression.Count - 1)
        {
            Debug.LogWarning("Max power up reached.");
            return(null);
        }
        return(m_powerUpProgression[currentIndex + 1]);
    }
Exemplo n.º 5
0
 public IEnumerator StartPowerUp(PowerUpConfig c)
 {
     //Debug.Log("PowerUp: " + c.powerUp.ToString("G") + ", Time: " + c.time.ToString());
     if (powerUps.ContainsKey(c.powerUp))
     {
         powerUps[c.powerUp].time   += c.time;
         powerUps[c.powerUp].maxTime = powerUps[c.powerUp].time;
     }
     else
     {
         powerUps.Add(c.powerUp, new pTime {
             time = c.time, maxTime = c.time
         });
     }
     //remember max time for GUI
     yield return(null);
 }
Exemplo n.º 6
0
    /// <summary>
    /// Applies powerup to the player and returns status text
    /// </summary>
    private static string ApplyPowerup(PowerUpConfig pConfig, Player pPlayer)
    {
        ESound sound = ESound.None;

        switch (pConfig.Type)
        {
        case EPowerUp.Health:
            pPlayer.Stats.AddHealth(20);
            sound = ESound.Item_Powerup_Heal;
            break;

        case EPowerUp.Ammo:
            pPlayer.WeaponController.OnPowerUpAmmo();
            sound = ESound.Item_Powerup_Ammo;
            break;

        case EPowerUp.Speed:
            pPlayer.Stats.StatsEffect.ApplyEffect(EPlayerEffect.DoubleSpeed, SPEED_DURATION);                    //, SPEED_VALUE);
            sound = ESound.Item_Powerup_Speed;
            break;

        case EPowerUp.Mystery:
            return(HandleMystery(pPlayer));

        case EPowerUp.Shield:
            pPlayer.Stats.StatsEffect.ApplyEffect(EPlayerEffect.Shield, SHIELD_DURATION);
            sound = ESound.Item_Powerup_Shield;
            break;

        default:
            Debug.LogError($"Powerup {pConfig.Type} not handled!");
            break;
        }
        pPlayer.PlaySound(sound);

        return(pConfig.MapItemInfo.StatusText);
    }
 public RateOfFirePowerUp(PowerUpConfig config) : base(config)
 {
 }
Exemplo n.º 8
0
 private void Start()
 {
     config = GameController.instance.gameConfig.powerUpConfig;
 }
Exemplo n.º 9
0
 public PowerUp(PowerUpConfig config)
 {
     m_config = config;
 }
 public SurvivabilityPowerUp(PowerUpConfig config) : base(config)
 {
 }
 public ClassicShootPowerUp(PowerUpConfig config) : base(config)
 {
 }
Exemplo n.º 12
0
 public ShotTypePowerUp(PowerUpConfig config) : base(config)
 {
 }
Exemplo n.º 13
0
 public LaserShootPowerUp(PowerUpConfig config) : base(config)
 {
 }