Ejemplo n.º 1
0
 void init_card_Stack()
 {
     this.actionStack     = new ActionStack(5);
     this.actionSelection = new ActionStack(0);
     this.actionStack.actionList.Add(ActionCardStorage.GetForward());
     this.actionStack.actionList.Add(ActionCardStorage.GetBackward());
     this.actionStack.actionList.Add(ActionCardStorage.GetRotationRight());
     this.actionStack.actionList.Add(ActionCardStorage.GetRotationLeft());
     this.actionStack.actionList.Add(ActionCardStorage.GetEmpty());
 }
Ejemplo n.º 2
0
 public ActionCard getActionCard(int index)
 {
     if (index < actionList.Count)
     {
         return(actionList[index]);
     }
     else
     {
         return(ActionCardStorage.GetEmpty());
     }
 }
Ejemplo n.º 3
0
    private void AddWeaponListener()
    {
        for (int i = 1; i <= 2; i++)
        {
            if (player.getWeapon(i) != "" && player.mainFuel >= 3)
            {
                switch (player.getWeapon(i))
                {
                case "gravityMine":
                    if (i == 1)
                    {
                        GameObject.Find("HUD_Weapon_1").GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (player.actionSelection.getSize() < 5)
                            {
                                player.actionSelection.addActionCard(ActionCardStorage.GetGravityMine());
                                player.looseFuel(3);
                                player.CardCounterChange(1);
                                removeWeapon(player.getWeapon(1), player);
                                EventManager.TriggerEvent("Player_Card_Selection_Changed");
                                EventManager.TriggerEvent("Player_Main_Fuel_Has_Changed");
                                EventManager.TriggerEvent("Player_Add_Fuel_Has_Changed");
                            }
                        });
                    }
                    else
                    {
                        GameObject.Find("HUD_Weapon_2").GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (player.actionSelection.getSize() < 5)
                            {
                                player.actionSelection.addActionCard(ActionCardStorage.GetGravityMine());
                                player.CardCounterChange(1);
                                player.looseFuel(3);
                                removeWeapon(player.getWeapon(2), player);
                                EventManager.TriggerEvent("Player_Card_Selection_Changed");
                                EventManager.TriggerEvent("Player_Main_Fuel_Has_Changed");
                                EventManager.TriggerEvent("Player_Add_Fuel_Has_Changed");
                            }
                        });
                    }
                    break;

                case "rocket":
                    if (i == 1)
                    {
                        GameObject.Find("HUD_Weapon_1").GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (player.actionSelection.getSize() < 5)
                            {
                                player.actionSelection.addActionCard(ActionCardStorage.GetRocket());
                                player.looseFuel(3);
                                player.CardCounterChange(1);
                                removeWeapon(player.getWeapon(1), player);
                                EventManager.TriggerEvent("Player_Card_Selection_Changed");
                                EventManager.TriggerEvent("Player_Main_Fuel_Has_Changed");
                                EventManager.TriggerEvent("Player_Add_Fuel_Has_Changed");
                            }
                        });
                    }
                    else
                    {
                        GameObject.Find("HUD_Weapon_2").GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (player.actionSelection.getSize() < 5)
                            {
                                player.actionSelection.addActionCard(ActionCardStorage.GetRocket());
                                player.CardCounterChange(1);
                                player.looseFuel(3);
                                removeWeapon(player.getWeapon(2), player);
                                EventManager.TriggerEvent("Player_Card_Selection_Changed");
                                EventManager.TriggerEvent("Player_Main_Fuel_Has_Changed");
                                EventManager.TriggerEvent("Player_Add_Fuel_Has_Changed");
                            }
                        });
                    }
                    break;

                case "laser":
                    if (i == 1)
                    {
                        GameObject.Find("HUD_Weapon_1").GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (player.actionSelection.getSize() < 5)
                            {
                                player.actionSelection.addActionCard(ActionCardStorage.GetLaser());
                                player.looseFuel(3);
                                player.CardCounterChange(1);
                                removeWeapon(player.getWeapon(1), player);
                                EventManager.TriggerEvent("Player_Card_Selection_Changed");
                                EventManager.TriggerEvent("Player_Main_Fuel_Has_Changed");
                                EventManager.TriggerEvent("Player_Add_Fuel_Has_Changed");
                            }
                        });
                    }
                    else
                    {
                        GameObject.Find("HUD_Weapon_2").GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (player.actionSelection.getSize() < 5)
                            {
                                player.actionSelection.addActionCard(ActionCardStorage.GetLaser());
                                player.CardCounterChange(1);
                                player.looseFuel(3);
                                removeWeapon(player.getWeapon(2), player);
                                EventManager.TriggerEvent("Player_Card_Selection_Changed");
                                EventManager.TriggerEvent("Player_Main_Fuel_Has_Changed");
                                EventManager.TriggerEvent("Player_Add_Fuel_Has_Changed");
                            }
                        });
                    }
                    break;
                }
            }
        }
    }