public void RemoveArrowType(Enums.Arrows type) { // Clear the appropriate token bit and remove the timer from the list of running timers types = Bitwise.ClearBit(types, (int)type); TokenTimer t = timers.Find(i => i.ID.Equals(type.ToString())); timers.Remove(t); }
public void AddArrowType(Enums.Arrows type) { if (type > 0 && type < Enums.Arrows.NumTypes) { // Find the running timer associated with the type TokenTimer t = timers.Find(i => i.ID.Equals(type.ToString())); // If the type has not been added yet if (t == null) { // Add a new Token Timer and initialize it TokenTimer tt = gameObject.AddComponent <TokenTimer>(); tt.Initialize(TokenTimer.TOKEN_INTERVAL, type.ToString()); // Make sure that the type is removed from the component when the timer times out tt.TimeOut += new TokenTimer.TimerEvent(RemoveToken); types = Bitwise.SetBit(types, (int)type); timers.Add(tt); } else { // Type has already been added so we just need to reset the timer t.Reset(); } } }
/// <summary> /// Gets the prefab based on the arrow type. /// </summary> /// <param name="type">The type of arrow that needs a prefab.</param> /// <returns>The appropriate effect for the arrow property.</returns> public GameObject GetEffect(Enums.Arrows type) { return(effectPrefabs.Find(x => x.name.StartsWith(type.ToString()))); }