예제 #1
0
 public void Give(GameObject specialPrefab, int pickupAmount)
 {
     if (this.powerTemplate == specialPrefab)
     {
         this.powerCount += pickupAmount;
     }
     else
     {
         this.powerTemplate   = specialPrefab;
         this.powerCount      = pickupAmount;
         this.powerController = this.powerTemplate.GetComponent <SpecialPowerController>();
     }
 }
예제 #2
0
    private IEnumerator FireSpecial()
    {
        var special    = Instantiate(powerTemplate, this.transform.position, this.transform.rotation) as GameObject;
        var controller = special.GetComponent <SpecialPowerController>();

        if (controller != null)
        {
            controller.OnSpecialEnd = SpecialEnded;
        }
        specialInAction = true;
        powerCount--;

        if (powerCount <= 0)
        {
            powerTemplate        = null;
            this.powerController = null;
        }

        yield break;
    }