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; }
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(); }