示例#1
0
 /// <summary>
 /// Spawns a token
 /// </summary>
 /// <param name="tokenPrefab">The token to be spawned</param>
 private  void SpawnToken(GameObject tokenPrefab)
 {
     tokenPrefab.transform.position = transform.position;
     // Turn on token since pooling
     tokenPrefab.SetActive(true);
     spawnItem = tokenPrefab.GetComponent<Token>();
 }
示例#2
0
文件: Life.cs 项目: dvalles/Rangers
 /// <summary>
 /// Overriding the collect token method from player controller object
 /// </summary>
 /// <param name="token">The token that was collected</param>
 public override void CollectToken(Token token)
 {
     // Handle what type of token was collected
     if (token.GetType().Equals(typeof(HealthToken)))
     {
         // Add health back to the player
        ModifyHealth(((HealthToken)token).Health);
     }
 }
示例#3
0
        /// <summary>
        /// Called by colliding with a Token (from Token's OnTriggerEnter)
        /// </summary>
        /// <param name="token">Token that was collected</param>
        public override void CollectToken(Token token)
        {
            // Handle what type of token was collected
            if (token.GetType().Equals(typeof(ArrowToken)))
            {
				AddArrowType(((ArrowToken)token).Type);
            }
        }
示例#4
0
		/// <summary>
		/// Overriding the collect token method from player controller object
		/// </summary>
		/// <param name="token">The token that was collected</param>
		public override void CollectToken(Token token) { }
示例#5
0
 /// <summary>
 /// Called by colliding with a Token (from Token's OnTriggerEnter)
 /// </summary>
 /// <param name="token">Token that was collected</param>
 public override void CollectToken(Token token)
 {
     // Handle what type of token was collected
     if (token.GetType().Equals(typeof(ArrowToken)))
     {
         // Find the running timer associated with the token
         TokenTimer t = timers.Find(i => i.ID.Equals(((ArrowToken)token).Type.ToString()));
         // If the token has not been collected yet
         if (t == null)
         {
             // Add a new Token Timer and initialize it
             TokenTimer tt = gameObject.AddComponent<TokenTimer>();
             tt.Initialize(TokenTimer.TOKEN_INTERVAL, ((ArrowToken)token).Type.ToString());
             // Make sure that the token is removed from the component when the timer times out
             tt.TimeOut += new TokenTimer.TimerEvent(RemoveToken);
             types = Bitwise.SetBit(types, (int)tt.TokenType);
             timers.Add(tt);
         }
         else
         {
             // Token has already been collected so we just need to reset the timer
             t.Reset();
         }
     }
 }
示例#6
0
 // Virtual method for collecting battle tokens
 public abstract void CollectToken(Token token);