//Change the texture of the model based on the enemy code public void ChangeSkin(PowerUpTypes powerUpType) { switch (powerUpType) { case PowerUpTypes.DOUBLE_ATTACK: foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.Texture = textures[0]; } } break; case PowerUpTypes.SPEED_ATTACK: foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.Texture = textures[1]; } } break; default: break; } }
private void I_ActivatePowerUp(object newPowerUp) { PowerUpTypes weapon = (PowerUpTypes)newPowerUp; switch (weapon) { case PowerUpTypes.SpeedBoost: _SpeedBoostTimer = _speedBoostPresence; _isSpeedBoostActive = true; break; case PowerUpTypes.Shield: if (ShieldsAreActive == true) { return; } ShieldsAreActive = true; break; case PowerUpTypes.Health: _Event_AddHealth.Invoke(this); break; default: break; } }
public void GetPowerUp() { currentPowerUp = (PowerUpTypes)Random.Range(0, System.Enum.GetValues(typeof(PowerUpTypes)).Length); switch (currentPowerUp) { case PowerUpTypes.regenarateHealth: playerHealth.Heal(healAmount); break; case PowerUpTypes.speedUp: StartCoroutine(playerMovement.SpeedUpForSeconds(playerMovement.Speed * speedIncrement, powerUpDuration)); break; case PowerUpTypes.bubbleShield: StartCoroutine(playerHealth.GetBubbleShield(powerUpDuration)); break; default: StartCoroutine(PowerUpDurationTimer()); break; } }
/// <summary> /// Returns a random power up. /// </summary> /// <returns>The power up game object.</returns> internal GameObject PickOne() { int randomIndex = UnityEngine.Random.Range(0, Enum.GetNames(typeof(PowerUpTypes)).Length); PowerUpTypes powerUpType = (PowerUpTypes)randomIndex; return(getPowerUpPrefab(powerUpType)); }
private IEnumerator DestroyMatchedCells(IDictionary <ICell, IList <ICell> > matchedCellsDictionary) { foreach (var cellList in matchedCellsDictionary) { if (cellList.Key.CurrentGameObject != null) { if (cellList.Value.Count > 3) { int matchCount = cellList.Value.Count; _colorsList.Add(Helper.DetectColor(cellList.Key)); PowerUpTypes powerUp = Helper.DetectPowerUp(matchCount); _spawnedPowerUpDictionary.Add( new Vector3(cellList.Key.TargetX, cellList.Key.TargetY, 0f), powerUp); } } WorkAfterMatch(cellList.Value); } _matchedCellsDictionary.Clear(); yield return(new WaitForSeconds(StringsAndConst.TIME_AFTER_DESTROY)); OnEvent(EventTypes.BOARD_EndDestroyMatchedCells, null); }
public override void init() { base.init(); dataManager = DataManager.instance; powerUpType = GetComponent <PowerUpObject>().powerUpType; }
public GameObject SpawnPowerPrefab(PowerUpTypes powerUpType, Vector3 position) { GameObject powerGameObject = _objectStorage.GetPowerElement(powerUpType); _objectSetter.SetGameObject(powerGameObject, position); return(powerGameObject); }
public override void Init() { base.Init(); dataManager = DataManager.instance; powerUpType = GetComponent<PowerUpObject>().powerUpType; }
public int GetPowerUpCost(PowerUpTypes powerUpType) { if (currentPowerupLevel[(int)powerUpType] < staticData.GetTotalPowerUpLevels()) { return(staticData.GetPowerUpCost(powerUpType, currentPowerupLevel[(int)powerUpType])); } return(-1); // out of power up upgrades }
// something has changed (item change, purchase, etc). Need to refresh the gui text public void RefreshStoreGUI() { int cost = -1; if (storeSelectingPowerUp) { PowerUpTypes powerUp = (PowerUpTypes)storeItemIndex; cost = dataManager.GetPowerUpCost(powerUp); storeBuyButton.SetActive(cost != -1); if (useuGUI) { storeTitleText.text = dataManager.GetPowerUpTitle(powerUp); storeDescriptionText.text = dataManager.GetPowerUpDescription(powerUp); storePowerUpSelectionButtonText.text = "Characters"; } else { #if COMPILE_NGUI storeTitle.text = dataManager.GetPowerUpTitle(powerUp); storeDescription.text = dataManager.GetPowerUpDescription(powerUp); storePowerUpSelectionButton.text = "Characters"; #endif } } else // characters { cost = dataManager.GetCharacterCost(storeItemIndex); storeBuyButton.SetActive(cost != -1); if (useuGUI) { storeTitleText.text = dataManager.GetCharacterTitle(storeItemIndex); storeDescriptionText.text = dataManager.GetCharacterDescription(storeItemIndex); storePowerUpSelectionButtonText.text = "Power Ups"; } else { #if COMPILE_NGUI storeTitle.text = dataManager.GetCharacterTitle(storeItemIndex); storeDescription.text = dataManager.GetCharacterDescription(storeItemIndex); storePowerUpSelectionButton.text = "Power Ups"; #endif } } if (useuGUI) { storeCoinsText.text = string.Format("{0} ({1} Coins Available)", (cost == -1 ? "Purchased" : string.Format("Cost: {0}", cost.ToString())), dataManager.GetTotalCoins(true)); } else { #if COMPILE_NGUI storeCoins.text = string.Format("{0} ({1} Coins Available)", (cost == -1 ? "Purchased" : string.Format("Cost: {0}", cost.ToString())), dataManager.GetTotalCoins(true)); #endif } }
public void Start() { gameManager = GameManager.instance; dataManager = DataManager.instance; gameManager.OnPauseGame += GamePaused; activePowerUp = PowerUpTypes.None; activePowerUpData = new CoroutineData(); }
void Start() { gameManager = GameManager.instance; dataManager = DataManager.instance; GameManager.instance.onPauseGame += gamePaused; activePowerUp = PowerUpTypes.None; activePowerUpData = new CoroutineData(); }
IEnumerator Drope(GameObject nukeObject) { Transform nukeDropPos = (this.tag == "Player1") ? GameObject.FindGameObjectWithTag("Player2").transform : GameObject.FindGameObjectWithTag("Player1").transform; GameObject tempNuke = Instantiate(nukeObject, new Vector3(nukeDropPos.position.x, nukeDropPos.position.y + 10f, nukeDropPos.position.z), Quaternion.Euler(new Vector3(0, 0, 180f))) as GameObject; yield return(new WaitForSeconds(0.01f)); pType = PowerUpTypes.None; }
public PowerUp(Vector2 Position, PowerUpTypes PowerUpType) { this.Position = Position; this.PowerUpType = PowerUpType; SpriteWidth = 24; SpriteHeight = 24; Origin.Y = 24; this.Mask = PowerUp.ActiveMask; }
public static UInt32?GetPowerUpUsesLeft(PowerUpTypes powerUp) { UInt32?usesLeft = null; if (powerUps.ContainsKey(powerUp)) { usesLeft = powerUps[powerUp]; } return(usesLeft); }
public static PowerUpTypes DetectPowerUp(int matchCount) { PowerUpTypes powerUp = PowerUpTypes.None; if (matchCount >= 4) { powerUp = PowerUpTypes.Gravity; } return(powerUp); }
public void DeactivatePowerUp() { if (activePowerUp == PowerUpTypes.None) return; // Be sure the coroutine is stopped, deactivate may be called before runPowerUp is finished StopCoroutine("RunPowerUp"); gameManager.ActivatePowerUp(activePowerUp, false); activePowerUp = PowerUpTypes.None; activePowerUpData.duration = 0; }
public static void AddToPowerUp(PowerUpTypes powerUp) { //This code is intended for debugging if (powerUps == null) { Initialise(); } powerUps[powerUp]++; SaveChanges(); }
public void activatePowerUp(PowerUpTypes powerUpType, bool activate) { if (activate) { // deactivate the current power up (if a power up is active) and activate the new one powerUpManager.deactivatePowerUp(); powerUpManager.activatePowerUp(powerUpType); audioManager.playSoundEffect(SoundEffects.PowerUpSoundEffect); } playerController.activatePowerUp(powerUpType, activate, dataManager.getPowerUpColor(powerUpType)); }
public void ActivatePowerUp(PowerUpTypes powerUpType, bool activate) { if (activate) { // deactivate the current power up (if a power up is active) and activate the new one powerUpManager.DeactivatePowerUp(); powerUpManager.ActivatePowerUp(powerUpType); audioManager.PlaySoundEffect(SoundEffects.PowerUpSoundEffect); } playerController.ActivatePowerUp(powerUpType, activate); guiManager.ActivatePowerUp(powerUpType, activate, dataManager.GetPowerUpLength(powerUpType)); }
public void UpgradePowerUp(PowerUpTypes powerUpType) { // Can't upgrade if the player can't afford the power up int cost = dataManager.GetPowerUpCost(powerUpType); if (dataManager.GetTotalCoins(true) < cost) { return; } dataManager.UpgradePowerUp(powerUpType); dataManager.AdjustTotalCoins(-cost, true); }
public void UsePowerUp(PowerUpTypes powerUp) { Debug.Log("UsePowerUp: " + powerUp.ToString()); switch (powerUp) { case PowerUpTypes.EXTRA_TIME: ExtraTime(); break; case PowerUpTypes.GOLDEN_KNIFE: GoldenKnife(); break; } }
void Start() { playerRB = GetComponent <Rigidbody2D> (); anim = GetComponent <Animator> (); spRenderer = GetComponent <SpriteRenderer> (); canJumpTwice = false; hasPowerUP = false; pType = PowerUpTypes.None; infected = false; currentPlayerTag = gameObject.tag; OwnInvetorySlot = (gameObject.tag == "Player1") ? GameManager.Instance.pOneInventorySlot : GameManager.Instance.PTwoInventorySlot; }
public void deactivatePowerUp() { if (activePowerUp == PowerUpTypes.None) { return; } // Be sure the coroutine is stopped, deactivate may be called before runPowerUp is finished StopCoroutine("runPowerUp"); gameManager.activatePowerUp(activePowerUp, false); activePowerUp = PowerUpTypes.None; activePowerUpData.duration = 0; }
public static PowerUpTypes StringToPowerType(string powerTypeString) { PowerUpTypes powerUpType = PowerUpTypes.None; switch (powerTypeString) { case StringsAndConst.TAG_GRAVITY: powerUpType = PowerUpTypes.Gravity; break; } return(powerUpType); }
public void upgradePowerUp(PowerUpTypes powerUpType) { // Can't upgrade if the player can't afford the power up int cost = dataManager.getPowerUpCost(powerUpType); if (dataManager.getTotalCoins() < cost) { return; } dataManager.upgradePowerUp(powerUpType); dataManager.adjustTotalCoins(-cost); guiManager.refreshStoreGUI(); }
public override void FromBytes(BinaryReader reader) { base.FromBytes(reader); Name = reader.ReadString(); Color = reader.ReadByte(); Position = new Vector2(reader.ReadSingle(), reader.ReadSingle()); Direction = reader.ReadSingle(); Speed = reader.ReadSingle(); TurretDirection = reader.ReadSingle(); Health = reader.ReadByte(); Shield = reader.ReadByte(); ActivePowerUp = (PowerUpTypes)reader.ReadByte(); }
public void SetPowerUp(PowerUpTypes p) { this.powerUpType = p; switch (p) { case PowerUpTypes.GLOCK: CreatePowerup("PUGlock"); break; case PowerUpTypes.KATANA: CreatePowerup("PUKatana"); break; } }
/// <summary> /// Displaies the power up. /// </summary> /// <param name="type">The power up type.</param> /// <param name="duration">The duration of the power up.</param> public void DisplayPowerUp(PowerUpTypes type, float duration, string title) { if (title == "") { Debug.LogError("no title defined"); return; } if (duration != -1) { title += " (" + duration + "s) !"; } uiManager.ShowItemActivatedEventText(title, 3f); }
/// <summary> /// Applies the power up. /// </summary> /// <param name="type">The power up type to apply.</param> /// <param name="duration">The duration of the power up.</param> public void ApplyPowerUp(PowerUpTypes type, float duration) { switch (type) { case PowerUpTypes.DoubledShotSpeed: StartCoroutine(DoubledShotSpeed(duration)); break; case PowerUpTypes.HalfedShotSpeed: StartCoroutine(HalfedScore(duration)); break; case PowerUpTypes.DoubledScore: StartCoroutine(DoubledScore(duration)); break; case PowerUpTypes.HalfedScore: StartCoroutine(HalfedScore(duration)); break; case PowerUpTypes.LiveUp: LiveUp(); break; case PowerUpTypes.LiveDown: LiveDown(); break; case PowerUpTypes.EnemySmaller: StartCoroutine(EnemySmaller(duration)); break; case PowerUpTypes.EnemyBigger: StartCoroutine(EnemyBigger(duration)); break; case PowerUpTypes.EnemyFreeze: StartCoroutine(EnemyFreeze(duration)); break; case PowerUpTypes.EnemyDoubledSpeed: StartCoroutine(EnemyDoubledSpeed(duration)); break; default: Debug.Log("PowerUp type not implemented"); break; } }
IEnumerator SwitchPos() { GameObject otherPlayer = (this.gameObject.tag != "Player1") ? GameObject.FindGameObjectWithTag("Player1") : GameObject.FindGameObjectWithTag("Player2") as GameObject; GameObject ownPlayer = (this.gameObject.tag == "Player1") ? GameObject.FindGameObjectWithTag("Player1") : GameObject.FindGameObjectWithTag("Player2") as GameObject; Vector2 ownTransform = ownPlayer.transform.position; Vector2 otherTransform = otherPlayer.transform.position; Debug.Log("Own : " + ownTransform + " Other : " + otherTransform); yield return(new WaitForSeconds(0.2f)); pType = PowerUpTypes.None; otherPlayer.transform.position = new Vector2(ownTransform.x, ownTransform.y); ownPlayer.transform.position = new Vector2(otherTransform.x, otherTransform.y); }
private void CreatePowerUp(int x, int y, PowerUpTypes powerUpType) { float waveZOffset = 6000; float waveYOffset = 6500; float waveOffset = 30000; float pX = 10; float pY = y + y * waveYOffset; float pZ = camera.Position.Z + (x + x * waveZOffset) - (waveIndex * waveOffset); PowerUp power = new PowerUp(powerUpType); power.Initialise(); power.Position = new Vector3(pX, pY, pZ); powerUpManager.AddPowerUp(power); }
IEnumerator ThrowSomething(GameObject mushroomObject) { GameObject tempMushroom = Instantiate(mushroomObject, mushroomThrowPoint.position, mushroomThrowPoint.rotation); tempMushroom.transform.localScale = transform.localScale; float xDirection = (transform.localScale.x > 0f) ? 1f : -1f; tempMushroom.GetComponent <Mushroom>().playerCtrl = this; tempMushroom.GetComponent <Rigidbody2D>().AddForce(new Vector2(xDirection * 500f, 250f)); anim.SetTrigger("throw"); yield return(new WaitForSeconds(0.3f)); pType = PowerUpTypes.None; }
public string GetPowerUpTitle(PowerUpTypes powerUpType) { return powerUpTitle[(int)powerUpType]; }
public void ActivatePowerUp(PowerUpTypes powerUpType) { activePowerUp = powerUpType; activePowerUpData.duration = dataManager.GetPowerUpLength(powerUpType); StartCoroutine("RunPowerUp"); }
public string GetPowerUpDescription(PowerUpTypes powerUpType) { return powerUpDescription[(int)powerUpType]; }
public void ActivatePowerUp(PowerUpTypes powerUpType, bool activate) { if (powerUpType != PowerUpTypes.None) { ParticleSystem particleSystem = powerUpParticleSystem[(int)powerUpType]; if (activate) { particleSystem.Play(); } else { particleSystem.Stop(); } if (powerUpType == PowerUpTypes.CoinMagnet) { coinMagnetTrigger.SetActive(activate); } } }
/// <summary> /// Displaies the power up. /// </summary> /// <param name="type">The power up type.</param> /// <param name="duration">The duration of the power up.</param> public void DisplayPowerUp(PowerUpTypes type, float duration, string title) { if (title == "") { Debug.LogError("no title defined"); return; } if (duration != -1) title += " (" + duration + "s) !"; uiManager.ShowItemActivatedEventText(title, 3f); }
/// <summary> /// Returns the prefab of the power up with the given type. /// </summary> /// <returns>The power up prefab.</returns> /// <param name="type">The type of the power up.</param> private GameObject getPowerUpPrefab(PowerUpTypes type) { string powerUpString = type.ToString(); return Resources.Load("Prefabs/PowerUps/" + powerUpString) as GameObject; }
public int getPowerUpLevel(PowerUpTypes powerUpTypes) { return currentPowerupLevel[(int)powerUpTypes]; }
public GameObject getPowerUpPrefab(PowerUpTypes powerUpType) { return staticData.getPowerUpPrefab(powerUpType); }
public string getPowerUpTitle(PowerUpTypes powerUpType) { return staticData.getPowerUpTitle(powerUpType); }
public void activatePowerUp(PowerUpTypes powerUpType, bool activate) { if (powerUpType != PowerUpTypes.None) { ParticleSystem particleSystem = powerUpParticleSystem[(int)powerUpType]; if (activate) { particleSystem.Play(); } else { particleSystem.Stop(); } if (powerUpType == PowerUpTypes.CoinMagnet) { #if UNITY_3_5 coinMagnetTrigger.active = activate; #else coinMagnetTrigger.SetActive(activate); #endif } } }
public void ActivatePowerUp(PowerUpTypes powerUpType, bool active, float length) { if (active) { inGameActivePowerUpCutoffMaterial.SetFloat("_Cutoff", 0.0f); #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) if (useuGUI) { inGameActivePowerUpImage.sprite = inGamePowerUpSprites[(int)powerUpType]; } else { #endif #if COMPILE_NGUI inGameActivePowerUp.spriteName = powerUpType.ToString(); #endif #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) } #endif if (inGamePowerUpProgressWaitForSeconds == null) { inGamePowerUpProgressWaitForSeconds = new WaitForSeconds(0.05f); } inGamePowerUpData.duration = length; StartCoroutine("UpdatePowerUpProgress"); } else { StopCoroutine("UpdatePowerUpProgress"); } #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) if (useuGUI) { inGameActivePowerUpImage.gameObject.SetActive(active); } else { #endif #if COMPILE_NGUI inGameActivePowerUp.gameObject.SetActive(active); #endif #if !(UNITY_4_3 || UNITY_4_4 || UNITY_4_5) } #endif powerUpActive = active; }
public float getPowerUpLength(PowerUpTypes powerUpType) { return staticData.getPowerUpLength(powerUpType, currentPowerupLevel[(int)powerUpType]); }
public int getPowerUpCost(PowerUpTypes powerUpType) { if (currentPowerupLevel[(int)powerUpType] < staticData.getTotalPowerUpLevels()) { return staticData.getPowerUpCost(powerUpType, currentPowerupLevel[(int)powerUpType]); } return -1; // out of power up upgrades }
public void upgradePowerUp(PowerUpTypes powerUpType) { currentPowerupLevel[(int)powerUpType]++; PlayerPrefs.SetInt(string.Format("PowerUp{0}", (int)powerUpType), currentPowerupLevel[(int)powerUpType]); }
public GameObject GetPowerUpPrefab(PowerUpTypes powerUpType) { return powerUpPrefab[(int)powerUpType]; }
public int GetPowerUpCost(PowerUpTypes powerUpType, int level) { return powerUpCost[((int)powerUpType * totalPowerUpLevels) + level]; }
public string getPowerUpDescription(PowerUpTypes powerUpType) { return staticData.getPowerUpDescription(powerUpType); }
public float GetPowerUpLength(PowerUpTypes powerUpType, int level) { return powerUpLength[((int)powerUpType * (totalPowerUpLevels + 1)) + level]; }
public bool IsPowerUpActive(PowerUpTypes powerUpType) { return activePowerUp == powerUpType; }
public void activatePowerUp(PowerUpTypes powerUpType, bool active, float length) { if (active) { inGameActivePowerUpCutoffMaterial.SetFloat("_Cutoff", 0.0f); inGameActivePowerUp.spriteName = powerUpType.ToString(); if (inGamePowerUpProgressWaitForSeconds == null) { inGamePowerUpProgressWaitForSeconds = new WaitForSeconds(0.05f); } inGamePowerUpData.duration = length; StartCoroutine("updatePowerUpProgress"); } else { StopCoroutine("updatePowerUpProgress"); } inGameActivePowerUp.enabled = active; inGameActivePowerUpCutoff.enabled = active; powerUpActive = active; }