Пример #1
0
 private void OnPowerupExhausted(BasePowerup powerup)
 {
     if (myCollider.isTrigger)
     {
         myCollider.isTrigger = false;
     }
 }
Пример #2
0
 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;
 }
Пример #4
0
 private void OnPowerupCollected(BasePowerup powerup)
 {
     if (powerup.GetPowerupType() == PowerupType.Invincibility || powerup.GetPowerupType() == PowerupType.FastRunInvincibility)
     {
         myCollider.isTrigger = true;
     }
 }
Пример #5
0
        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;
     }
 }
Пример #7
0
    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());
        }
    }
Пример #8
0
    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);
        }
    }
Пример #9
0
    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);
            }
        }
    }
Пример #10
0
 public void AddPowerup(BasePowerup powerup)
 {
     Powerups.Add(powerup);
 }
 void CmdUpdatePowerup(string powerupName)
 {
     currentPowerup = null;
     currentPowerup = Resources.Load <BasePowerup>(powerupName);
 }
Пример #12
0
 private void OnPowerupCollected(BasePowerup powerup)
 {
     currentPowerup = powerup;
 }
Пример #13
0
 private void OnPowerupExhausted(BasePowerup powerup)
 {
     currentPowerup = null;
 }
Пример #14
0
 public virtual bool IsSame(BasePowerup another)
 {
     return(another.GetType() == this.GetType());
 }