public override void moveUnit(Coord destination)
    {
        base.moveUnit(destination);

        //Open the after-move options after moving this ally
        InGameMenus menus = GameObject.Find("GameManager").GetComponent <InGameMenus>();

        menus.openAfterMoveOptions();
    }
Beispiel #2
0
 public override void moveUnit(Coord destination)
 {
     if (GameManager.twoPlayer)
     {
         base.moveUnit(destination);
         //After-move options must be opened after an enemy moves in 2 player mode
         InGameMenus menus = GameObject.Find("GameManager").GetComponent <InGameMenus>();
         menus.openAfterMoveOptions();
     }
     else
     {
         movedEnemies.Add(this);
         base.moveUnit(destination);
     }
 }
 void Update()
 {
     if (Input.GetButtonDown("Win"))
     {
         Shape    _playerShape = GameObject.FindObjectOfType <Shape>();
         string[] tagNames     = new string[] { "SquareHole", "TriangleHole", "CircleHole", "HexagonHole" };
         int      i            = 0;
         foreach (string tagName in tagNames)
         {
             GameObject[] holes = GameObject.FindGameObjectsWithTag(tagName);
             if (holes.Length > 0)
             {
                 _playerShape.ChangeShape((ShapeType)i);
                 _playerShape.transform.position = holes[0].transform.position + new Vector3(0.5f, 0.5f, 0.0f);
                 return;
             }
             i++;
         }
     }
     else if (Input.GetButtonDown("Lose"))
     {
         Debug.Log("lose");
         GameObject.FindObjectOfType <GameManager>().remainingTransformation = 0;
     }
     else if (Input.GetButtonDown("NextLevel"))
     {
         InGameMenus inGameMenu = GameObject.FindObjectOfType <InGameMenus>();
         inGameMenu.NextLevel();
     }
     else if (Input.GetButtonDown("PreviousLevel"))
     {
         if (PreviousLevelExist())
         {
             Application.LoadLevel("Stratum" + PlayerPrefs.GetInt("currentStratum").ToString());
         }
         else
         {
             Application.LoadLevel("Menu");
         }
     }
 }
 void EndGame()
 {
     if (isWinning)
     {
         if (nextLevelExists())
         {
             if (sm != null)
             {
                 sm.PlayLvlEnd();
             }
             changeGameState(GameState.Start);
             InGameMenus.GoToNextLevel();
         }
         else
         {
             Application.LoadLevel("Menu");
         }
     }
     else
     {
         Application.LoadLevel(Application.loadedLevel);
     }
 }
Beispiel #5
0
	// Use this for initialization
	void Start () 
	{
		menu = GameObject.Find ("GameCanvas").GetComponent<InGameMenus> ();
	}
 void Awake()
 {
     currentLevel = PlayerPrefs.GetInt("currentLevel");
     menu         = gameObject.GetComponent <InGameMenus> ();
 }