// Use this for initialization void Start() { //init gameController //LauchCapacity parentFunction = GetComponentInParent<LauchCapacity>(); controllerName = parentFunction.getControllerName(); capacityIntChosen = parentFunction.capacityIntChosen; activated = false; switch (capacityIntChosen) { case CapacityEnum.Glyph: capacityChosen = GetComponentInChildren <GlyphCapacity>(); break; case CapacityEnum.Repulsion: capacityChosen = GetComponentInChildren <RepulseCapacity>(); break; case CapacityEnum.Meteor: capacityChosen = GetComponentInChildren <MeteorCapacity>(); break; case CapacityEnum.Freeze: capacityChosen = GetComponentInChildren <FreezeCapacity>(); break; default: Debug.Log("Default case"); break; } }
// Use this for initialization private void Start() { capacityIsTriggered = false; //init gameController DontDestroy parentFunction = GetComponentInParent <DontDestroy>(); controllerName = parentFunction.controllerName; switch (capacityIntChosen) { case Capacity.Glyph: capacityChosen = GetComponentInChildren <GlyphCapacity>(); break; case Capacity.Repulsion: capacityChosen = GetComponentInChildren <RepulseCapacity>(); break; default: Debug.Log("Default case"); break; } }
static void Main(string[] args) { #region Teste Question 1 Console.WriteLine("--------------------------Teste Question 1--------------------"); T3 r = new T3(); Console.WriteLine((r is T1) && (r is T2)); //false r = new T1(); Console.WriteLine((r is T1) && (r is T2)); // true #endregion #region Teste Question 3 Console.WriteLine("--------------------------Teste Question 3--------------------"); B b = new B(); A a = b; ICapacity c = a; b.MaxLevel += Handler1; // b have Handler1 a.MaxLevel += Handler2; // a have handler2 but references b so have handler1 to //output -> Regist Handler2 in A b.MaxLevel += Handler1; // b have a base event handler2 and 2 handler1 in invocation list b.Simulatelevel(60); //output-- For a) //trigger Max Level in B //Handler with level 60 //Handler with level 60 // for b) the same a.Simulatelevel(40); //For a) //trigger Max Level in B //Handler with level 40 //Handler with level 40 //for b) the same // class B ja tem a interface implementada aquando cria a assinatura do evento MaxLevel, deste modo estar //explicito ou nao na assinatura da class que ela implementa a interface ICapacity é dispensavel. #endregion #region Teste Question 4 Console.WriteLine("--------------------------Teste Question 4--------------------"); S?s1 = new S { Val = 2 }, s2 = new S { Val = 3 }; ShowMax <S?>(ref s1, ref s2); //box #endregion #region Teste Question 5 Console.WriteLine("--------------------------Teste Question 5--------------------"); TestPrices(); #endregion #region Teste Question 6 Console.WriteLine("--------------------------Teste Question 6--------------------"); // //b) // Console.WriteLine("--------------------------Teste Question 6 b)--------------------"); var members = exe6.ListStereotipedElements <TestListStereotipedElements>(); foreach (MemberInfo mf in members) { Console.WriteLine("Name method - " + mf.Name + " | MemberType - " + mf.MemberType); } // //c) // Console.WriteLine("--------------------------Teste Question 6 c)--------------------"); string [] cats = new [] { "cat1", "cat2", "cat3" }; var pairs = exe6.CreatFromCateg <Categorized>(cats); foreach (var p in pairs) { Console.WriteLine("Categoria ->" + p.first + " | Instancia ->" + p.second); } #endregion }