public static void RunTests() { Console.WriteLine("Base Ability: "); Ability normal = new Ability(); normal.Activate(); Console.WriteLine("\n\nDerived Ability: "); Ability openChest = new Open("Open Chest."); openChest.Activate(); Console.WriteLine("\n\nInterface Spell: "); Fireball fireball = new Fireball(3.5f, (d) => { Console.WriteLine("Burn..."); }); Console.WriteLine("-----------"); fireball.Cast(); Console.WriteLine("\n\nUsing both Interface & Inheritance: "); SuperAbility myUlt = new SuperAbility("Lord of Vermillion", (cool) => { Console.WriteLine("Lightning crashes down from the heavens, the caster needs to rest for " + cool + "seconds"); }); myUlt.SetCooldown(6); myUlt.Cast(); Console.WriteLine("\n\nEnd of Inheritance/Interface Examples"); }
public void ActivateAbility() { if (actualAbility == null) { return; } actualAbility.Activate(); activeAbilities.Add(actualAbility); actualAbility = null; abilityImage.ClearImage(); }
void Start() { moveAbility = GetComponentInChildren <AbstractMovementAbility>(); superAbility = GetComponentInChildren <SuperAbility>(); genAbility = GetComponentInChildren <AbstractGenericAbility>(); stats = GetComponent <Stats>(); node = NetworkNode.node; if (node is Client || node is Server) { if (players.Count == 0) { node.Subscribe(this); //only the first element should be subscribed to the node } players.Add(new NetworkPlayerIdentity(stats.playerID, stats.networkMode, this)); node.Subscribe <OutgoingNetworkStreamMessage>(this); } }
private void UpdateAbilities() { int i = 0; while (i < 10) { if (i >= activeAbilities.Count) { break; } SuperAbility x = activeAbilities[i]; x.Update(); if (x.IsFinished()) { activeAbilities.Remove(x); } i++; } }
public void ClearAbility() { actualAbility = null; abilityImage.ClearImage(); }