示例#1
0
 void FixedUpdate()
 {
     if (countingDown)
     {
         if (timeTillDamage_seconds <= 0)
         {
             if (damageAnimationPrefab != null)                   //play damage animation
             {
                 Instantiate(damageAnimationPrefab, transform.position, new Quaternion());
                 countingDown    = false;
                 animationRuning = true;
                 SpriteRenderer sr = GetComponent <SpriteRenderer>();
                 if (sr != null)
                 {
                     sr.sprite = null;
                 }
             }
         }
         else
         {
             timeTillDamage_seconds -= Time.fixedDeltaTime;
         }
     }
     else if (animationRuning)
     {
         timeTillDamagePointInDamageAnimation_seconds -= Time.fixedDeltaTime;
         if (timeTillDamagePointInDamageAnimation_seconds <= 0)
         {
             damageActors();
             UnityExtentionMethods.destoryAllChildren(transform);
         }
     }
 }
示例#2
0
 private void actorDies()
 {
     UnityExtentionMethods.destoryAllChildren(transform);
     dead = true;
     //TAG: level analytics
     if (team != DamageSources.player1)
     {
         LevelAnalytics.Instance.enemyDestroyed();
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (objectFollowing != null)
     {
         transform.position = objectFollowing.position;
     }
     else
     {
         UnityExtentionMethods.destoryAllChildren(transform);
     }
 }
示例#4
0
 private void Awake()
 {
     //WARNING this assumes PauseGameWorld transform is parented to a canvas
     if (PauseMenuHandler.Instance.pauseMenuExists())
     {
         Debug.LogWarning("Pause menu already exists! \n destroying this one");
         UnityExtentionMethods.destoryAllChildren(transform.parent);
         return;
     }
     PauseMenuHandler.Instance.setPauseMenu(transform.parent.gameObject);
 }
示例#5
0
    private void InitCardSelector()
    {
        for (int i = 0; i < transform.childCount; i++)
        {
            UnityExtentionMethods.destoryAllChildren(transform.GetChild(i));
        }

        IEnumerable <Card> allCards = ReflectiveEnumerator.GetEnumerableOfType <Card>();

        foreach (Card card in allCards)
        {
            //card base classes with this class name are not real cards and should be ignored
            if (card.GetType().Name.Contains("Base_"))
            {
                continue;
            }
            Instantiate(cardDisplayPrefab, transform).GetComponent <CardDisplayController>().setCardDisplay(card, deckList);
        }
    }
示例#6
0
 // Update is called once per frame
 void Update()
 {
     if (running)
     {
         if (spriteStateChangeTimer_seconds <= 0)
         {
             sr.enabled = !sr.enabled;
             spriteStateChangeTimer_seconds = flashRate_seconds;
         }
         else
         {
             spriteStateChangeTimer_seconds -= Time.deltaTime;
         }
         flashingLength_seconds -= Time.deltaTime;
         if (flashingLength_seconds <= 0)
         {
             running = false;
             if (destoryWhenDone)
             {
                 UnityExtentionMethods.destoryAllChildren(transform);
             }
         }
     }
 }
示例#7
0
	public void clearDeck() {
		foreach(CardDisplayController cardDisplayer in listOfCards) {
			UnityExtentionMethods.destoryAllChildren(cardDisplayer.transform);
		}
		listOfCards.Clear();
	}
示例#8
0
	public void removeCardFromDeck(CardDisplayController cardDisplay) {
		listOfCards.Remove(cardDisplay);
		UnityExtentionMethods.destoryAllChildren(cardDisplay.transform);
	}
示例#9
0
	private void Start() {
		for(int i = 0; i < cardListDisplay.childCount; i++) {
			UnityExtentionMethods.destoryAllChildren(cardListDisplay.GetChild(i));
		}
	}
示例#10
0
 public void destroyAreas()
 {
     UnityExtentionMethods.destoryAllChildren(transform);
 }
示例#11
0
 /// <summary>
 /// destroys the projectile along with it's children
 /// </summary>
 protected void destroyProjectile()
 {
     UnityExtentionMethods.destoryAllChildren(transform);
 }