/// Used to add the appropriatre script to the gameobject private ArrowProperty GetArrowProperty(Enums.Arrows type) { switch (type) { case Enums.Arrows.Fireball: return(gameObject.AddComponent <FireballArrow>()); case Enums.Arrows.Ice: return(gameObject.AddComponent <IceArrow>()); case Enums.Arrows.Thunder: return(gameObject.AddComponent <ThunderArrow>()); case Enums.Arrows.Acid: return(gameObject.AddComponent <AcidArrow>()); case Enums.Arrows.Ricochet: bounciness = RicochetArrow.bounces; return(gameObject.AddComponent <RicochetArrow>()); case Enums.Arrows.Ghost: return(gameObject.AddComponent <GhostArrow>()); case Enums.Arrows.Gravity: return(gameObject.AddComponent <GravityArrow>()); default: return(gameObject.AddComponent <NormalArrow>()); } }
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); numTokens++; // timers.Add(tt); //} //else //{ // Type has already been added so we just need to reset the timer // t.Reset(); //} } }
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); }
/// Used to add the appropriate script to the gameobject private ArrowProperty GetArrowProperty(Enums.Arrows type) { switch (type) { case Enums.Arrows.Fireball: return(gameObject.AddComponent <FireballArrow>()); case Enums.Arrows.Ice: return(gameObject.AddComponent <IceArrow>()); case Enums.Arrows.Thunder: return(gameObject.AddComponent <ThunderArrow>()); case Enums.Arrows.Acid: return(gameObject.AddComponent <AcidArrow>()); case Enums.Arrows.Ricochet: bounciness = RicochetArrow.bounces; return(gameObject.AddComponent <RicochetArrow>()); case Enums.Arrows.Ghost: return(gameObject.AddComponent <GhostArrow>()); case Enums.Arrows.ZeroGravity: return(gameObject.AddComponent <ZeroGravityArrow>()); case Enums.Arrows.Lifesteal: return(gameObject.AddComponent <LifestealArrow>()); case Enums.Arrows.Tracking: trackingTime = TrackingArrow.trackingTime; return(gameObject.AddComponent <TrackingArrow>()); case Enums.Arrows.Virus: return(gameObject.AddComponent <VirusArrow>()); case Enums.Arrows.Splitting: return(gameObject.AddComponent <SplittingArrow>()); case Enums.Arrows.HeavyKnockback: return(gameObject.AddComponent <HeavyKnockbackArrow>()); case Enums.Arrows.RapidFire: return(gameObject.AddComponent <RapidFireArrow>()); case Enums.Arrows.Grappling: return(gameObject.AddComponent <GrapplingArrow>()); case Enums.Arrows.Teleporting: return(gameObject.AddComponent <TeleportArrow>()); default: return(gameObject.AddComponent <NormalArrow>()); } }
/// <summary> /// Overriding the initialize method. Use the token type.ToString() as id /// </summary> /// <param name="interval">How long the timer will run for</param> /// <param name="id">ID of the timer</param> public override void Initialize(float interval, string id) { base.Initialize(interval, id); // Get the type of token based on the ID tokenType = (Enums.Arrows)Enum.Parse(typeof(Enums.Arrows), id); }
/// <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()))); }