private void OnPowerupExhausted(BasePowerup powerup) { if (myCollider.isTrigger) { myCollider.isTrigger = false; } }
public static void pickUpPowerup(BasePowerup pow) { if (onPickUpPowerup != null) { onPickUpPowerup(pow); } }
public void RemovePowerup() { isHoldingPowerup = false; currentPowerup = null; numUses = 0; powerupUI.GetComponentInChildren <Image>().enabled = false; }
private void OnPowerupCollected(BasePowerup powerup) { if (powerup.GetPowerupType() == PowerupType.Invincibility || powerup.GetPowerupType() == PowerupType.FastRunInvincibility) { myCollider.isTrigger = true; } }
public void AddPowerup(string powerupType) { var powerupsConfig = Locator.Find<RootConfig>().PowerupsConfig; BasePowerup powerup = null; playerController.AddPowerup(powerup); }
public void SetCurrentPowerup(BasePowerup powerup) { if (!isHoldingPowerup) { print(powerup.name); currentPowerup = powerup; isHoldingPowerup = true; CmdUpdatePowerup(currentPowerup.name); powerupUI.GetComponentInChildren <Image>().sprite = currentPowerup.powerupSprite; powerupUI.GetComponentInChildren <Image>().enabled = true; } }
void OnTriggerEnter(Collider other) { PowerupManager powerupManager = other.GetComponent <PowerupManager>(); if (powerupManager) { int randomNumber = Mathf.RoundToInt(Random.Range(0, powerupList.Count)); BasePowerup randomPowerup = powerupList[randomNumber]; powerupManager.SetCurrentPowerup(randomPowerup); if (audioSource) { audioSource.Play(); } StartCoroutine(DisablePowerup()); } }
public void AddPowerup(BasePowerup powerup) { if (powerup == null) { return; } var current = powerups.Find(p => p.IsSame(powerup)); if (current != null) { // such powerup already exists - just reset it's progress current.Reset(); } else { powerups.Add(powerup); powerup.Affect(this); } }
private void OnPowerupGenerated(BasePowerup powerup) { Platform parent; if (GameData.Instance.direction == Direction.Right) { parent = RightPlatform; } else { parent = LeftPlatform; } if (parent.GetPowerupPoint() != null) { Vector2 pos = parent.GetPowerupPoint().position; if (Mathf.Abs(pos.x - GameData.Instance.theRunnerTransform.position.x) > 13f) { powerup.ActivateAndSetPosition(pos, parent.transform); } } }
public void AddPowerup(BasePowerup powerup) { Powerups.Add(powerup); }
void CmdUpdatePowerup(string powerupName) { currentPowerup = null; currentPowerup = Resources.Load <BasePowerup>(powerupName); }
private void OnPowerupCollected(BasePowerup powerup) { currentPowerup = powerup; }
private void OnPowerupExhausted(BasePowerup powerup) { currentPowerup = null; }
public virtual bool IsSame(BasePowerup another) { return(another.GetType() == this.GetType()); }