示例#1
0
    // Use this for initialization
    void Start()
    {
        // Initialize stats info
        currentStats           = new StatsInfo();
        currentStats.startTime = Time.time;
        totalStats             = new StatsInfo();
        totalStats.startTime   = Time.time;
        // Get the Message Manager
        msgManager = GetComponent <MessageManager> ();
        // Get the Player
        player = GameObject.FindGameObjectWithTag("Player");
        // Get the Ninja Controller
        ninjaController = player.GetComponent <NinjaController> ();
        ninjaController.setMessageManager(msgManager);
        // Get the Puzzles
        GameObject puzzle = GameObject.FindGameObjectWithTag("Puzzle");

        if (puzzle != null)
        {
            // Find the puzzles
            if (puzzle.name.Equals("Fire Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                firePuzzle = puzzle;
            }
            else if (puzzle.name.Equals("Water Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                waterPuzzle = puzzle;
            }
            else if (puzzle.name.Equals("Combo Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                comboPuzzle = puzzle;
            }
        }
        // See if we need to find the pause UI
        if (pauseUI == null)
        {
            // Get the Pause UI
            pauseUI = GameObject.FindGameObjectWithTag("PauseUI");
        }
        // See if we need to find the stats UI
        if (statsUI == null)
        {
            // Get the Stats UI
            statsUI = GameObject.FindGameObjectWithTag("StatsUI");
            if (statsUI != null)
            {
                // Disable it for now
                statsUI.SetActive(false);
            }
        }
        // See if we need to find the ninja animation controller again
        if (ninjaAnimationController == null)
        {
            // Get the Ninja Animation Controller
            ninjaAnimationController = player.GetComponent <CyborgNinjaAnimationController> ();
        }
        // Get the pause script
        pauseScript = GetComponent <PauseGame> ();
    }
示例#2
0
    /// <summary>
    /// Update this instance.
    /// </summary>
    void FixedUpdate()
    {
        // Only update if active
        if (!gameActive)
        {
            return;
        }

        if (!controllable)
        {
            return;
        }

        // See if we need to find the pause UI
        if (pauseUI == null)
        {
            // Get the Pause UI
            pauseUI = GameObject.FindGameObjectWithTag("PauseUI");
        }
        // See if we need to find the ninja controller again
        if (player == null)
        {
            // Get the Player
            player = GameObject.FindGameObjectWithTag("Player");
        }
        // See if we need to find the ninja controller again
        if (ninjaController == null)
        {
            // Get the Ninja Controller
            ninjaController = player.GetComponent <NinjaController> ();
            // Set the message manager
            ninjaController.setMessageManager(msgManager);
        }
        // See if we need to find the ninja animation controller again
        if (ninjaAnimationController == null)
        {
            // Get the Ninja Animation Controller
            ninjaAnimationController = player.GetComponent <CyborgNinjaAnimationController> ();
        }
        // Get the Puzzles
        GameObject puzzle = GameObject.FindGameObjectWithTag("Puzzle");

        if (puzzle != null)
        {
            // Find the puzzles
            if (puzzle.name.Equals("Fire Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                firePuzzle = puzzle;
            }
            else if (puzzle.name.Equals("Water Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                waterPuzzle = puzzle;
            }
            else if (puzzle.name.Equals("Combo Puzzle", System.StringComparison.CurrentCultureIgnoreCase))
            {
                comboPuzzle = puzzle;
            }
        }

        // Check for Game Over
        CheckGameOver();
    }
 // Get the animation controller
 void Start()
 {
     InputManager.Setup();
     animationController = GetComponent <CyborgNinjaAnimationController> ();
     ninjaController     = GetComponent <NinjaController> ();
 }