Beispiel #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;
    }
 public PlayerWeaponProjectile(
     Player pOwner,
     MapWeaponConfig pConfig) :
     base(pOwner, pConfig.Id, pConfig.InHandWeaponInfo,
          pConfig.VisualInfo)
 {
     ProjectileInfo = pConfig.ProjectileInfo;
 }
Beispiel #3
0
    public MapWeaponConfig GetMapWeaponConfig(EWeaponId pId)
    {
        MapWeaponConfig config = MapWeapons.Find(a => a.Id == pId);

        if (config == null)        //not error
        {
            Debug.LogError($"Config for weapon {pId} not found");
        }

        return(config);
    }
Beispiel #4
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();
    }
Beispiel #5
0
    //TODO: create system to check weapon cathegory
    internal void AddMapWeapon(EWeaponId pWeapon)
    {
        if (pWeapon == EWeaponId.None)
        {
            Debug.LogError($"Added weapon was null");
            return;
        }
        MapWeaponConfig config =
            brainiacs.ItemManager.GetMapWeaponConfig(pWeapon);

        if (config == null)
        {
            return;
        }

        game.PlayerStatusManager.ShowMapItem(player.Stats.MapItemUiPosition.position, config.MapItemInfo);

        PlayerWeaponProjectile weaponProjectile =
            new PlayerWeaponProjectile(player, config);

        weapon.AddWeapon(weaponProjectile);
    }