示例#1
0
    //Mostrar menú de victoria
    void ShowVictoryMenu()
    {
        //Se busca el objeto que contiene los menus i se asigna a la variable
        menuManager = FindObjectOfType <GameMenuUI>();

        //Se está en menús
        SceneController.inMenu = true;

        //Mostrar el cursor
        Cursor.visible = true;

        menuManager.victoryMenu.SetActive(true);

        //Sonido
        AudioManager manager = FindObjectOfType <AudioManager>();

        manager.StopAllSounds();
        manager.PlaySound("GameComplete");
    }
    /*---------------------------------------------------- INITIALISATION ----------------------------------------------------*/

    public void Initialisation()
    {
        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
        gameMenuUI  = GameObject.Find("GameMenuUI").GetComponent <GameMenuUI>();

        w = KeyCode.W;
        a = KeyCode.A;
        s = KeyCode.S;
        d = KeyCode.D;

        left  = KeyCode.LeftArrow;
        right = KeyCode.RightArrow;
        up    = KeyCode.UpArrow;
        down  = KeyCode.DownArrow;

        num1     = KeyCode.Alpha1;
        num2     = KeyCode.Alpha2;
        spacebar = KeyCode.Space;

        consoleCamera = GetComponent <Camera>();
        levelDetails  = GameObject.Find("Level").GetComponent <LevelDetails>();

        levelDetails.consoleCameraControl = this;
    }
示例#3
0
 void Awake()
 {
     characterCtr = GameObject.FindObjectOfType <CharacterControl>();
     gameMenuCtr  = GameObject.FindObjectOfType <GameMenuUI>();
 }
示例#4
0
    /*---------------------------------------------------- INITIALISATION ----------------------------------------------------*/

    public void Initialisation()
    {
        //Set manager script references
        if (GameObject.Find("GameManager") != null)
        {
            gameManagerPhotonView = GameObject.Find("GameManager").GetComponent <PhotonView>();
            powerManager          = GameObject.Find("GameManager").GetComponent <PowerManager>();
        }

        else
        {
            Debug.LogWarning("Could not find GameManager! Is there a GameManager in the scene?");
        }

        gameMenuUI = GameObject.Find("GameMenuUI").GetComponent <GameMenuUI>();

        consoleCamera       = transform.FindChild("ConsoleCamera").gameObject;
        groundCheckCollider = transform.FindChild("GroundCheck").GetComponent <BoxCollider2D>();
        wallCheckCollider   = transform.FindChild("WallCheck").GetComponent <BoxCollider2D>();
        unpowerAllButton    = GameObject.Find("Unpower All Button");

        physicalColliders = LayerMask.GetMask("Wall", "Door", "Platform", "InteriorDoor");

        //Initialise Player Stats
        playerStats = GetComponent <PlayerStats>();

        //Initialises Animator and Colliders.
        anim            = transform.FindChild("Player Animation").GetComponent <Animator>();
        playerRigidbody = GetComponent <Rigidbody2D>();

        playerAnimPhotonView = transform.FindChild("Player Animation").GetComponent <PhotonView>();
        heartIconBehaviours  = transform.FindChild("Player Animation").GetComponent <HeartIconBehaviours>();
        jetpackBehaviours    = transform.FindChild("Player Animation").GetComponent <JetpackBehaviours>();
        print(playerAnimPhotonView.name + heartIconBehaviours.name + jetpackBehaviours.name);

        unpowerAllButton.GetComponent <Image>().enabled  = false;
        unpowerAllButton.GetComponent <Button>().enabled = false;

        gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        Cursor.visible = false;
        GameObject.Find("GameManager").GetComponent <MouseBehaviours>().enabled = true;

        left  = KeyCode.LeftArrow;
        right = KeyCode.RightArrow;
        up    = KeyCode.UpArrow;
        W     = KeyCode.W;
        A     = KeyCode.A;
        D     = KeyCode.D;
        E     = KeyCode.E;

        playerCameras = new GameObject[3];
        for (byte counter = 0; counter < playerCameras.Length; counter++)
        {
            playerCameras[counter] = transform.FindChild("Cameras").GetChild(counter).gameObject;
        }

        playerAudio = GetComponent <PlayerAudio>();

        if (GameObject.Find("AudioManager"))
        {
            audioManager = GameObject.Find("AudioManager").GetComponent <AudioManager>();
        }

        dialogBox = GameObject.Find("DialogBoxText").GetComponent <DialogBox>();
    }
	/*---------------------------------------------------- INITIALISATION ----------------------------------------------------*/

    public void Initialisation()
    {
        //Set manager script references
        if (GameObject.Find("GameManager") != null)
        {
            gameManagerPhotonView = GameObject.Find("GameManager").GetComponent<PhotonView>();
            powerManager = GameObject.Find("GameManager").GetComponent<PowerManager>();
        }

        else
            Debug.LogWarning("Could not find GameManager! Is there a GameManager in the scene?");

        gameMenuUI = GameObject.Find("GameMenuUI").GetComponent<GameMenuUI>();

        consoleCamera = transform.FindChild("ConsoleCamera").gameObject;
        groundCheckCollider = transform.FindChild("GroundCheck").GetComponent<BoxCollider2D>();
        wallCheckCollider = transform.FindChild("WallCheck").GetComponent<BoxCollider2D>();
        unpowerAllButton = GameObject.Find("Unpower All Button");

        physicalColliders = LayerMask.GetMask("Wall", "Door", "Platform", "InteriorDoor");

        //Initialise Player Stats
        playerStats = GetComponent<PlayerStats>();

        //Initialises Animator and Colliders.
        anim = transform.FindChild("Player Animation").GetComponent<Animator>();
        playerRigidbody = GetComponent<Rigidbody2D>();

        playerAnimPhotonView = transform.FindChild("Player Animation").GetComponent<PhotonView>();
        heartIconBehaviours = transform.FindChild("Player Animation").GetComponent<HeartIconBehaviours>();
        jetpackBehaviours = transform.FindChild("Player Animation").GetComponent<JetpackBehaviours>();
        print(playerAnimPhotonView.name + heartIconBehaviours.name + jetpackBehaviours.name);

        unpowerAllButton.GetComponent<Image>().enabled = false;
        unpowerAllButton.GetComponent<Button>().enabled = false;

        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();

        Cursor.visible = false;
        GameObject.Find("GameManager").GetComponent<MouseBehaviours>().enabled = true;

        left = KeyCode.LeftArrow;
        right = KeyCode.RightArrow;
        up = KeyCode.UpArrow;
        W = KeyCode.W;
        A = KeyCode.A;
        D = KeyCode.D;
        E = KeyCode.E;

        playerCameras = new GameObject[3];
        for (byte counter = 0; counter < playerCameras.Length; counter++)
            playerCameras[counter] = transform.FindChild("Cameras").GetChild(counter).gameObject;

        playerAudio = GetComponent<PlayerAudio>();

        if (GameObject.Find("AudioManager"))
            audioManager = GameObject.Find("AudioManager").GetComponent<AudioManager>();

        dialogBox = GameObject.Find("DialogBoxText").GetComponent<DialogBox>();
    }
	/*---------------------------------------------------- INITIALISATION ----------------------------------------------------*/

	public void Initialisation()
	{
		gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
		gameMenuUI = GameObject.Find("GameMenuUI").GetComponent<GameMenuUI>();

		w = KeyCode.W;
		a = KeyCode.A;
		s = KeyCode.S;
		d = KeyCode.D;
		
		left = KeyCode.LeftArrow;
		right = KeyCode.RightArrow;
		up = KeyCode.UpArrow;
		down = KeyCode.DownArrow;

		num1 = KeyCode.Alpha1;
		num2 = KeyCode.Alpha2;
		spacebar = KeyCode.Space;

		consoleCamera = GetComponent<Camera>();
		levelDetails = GameObject.Find("Level").GetComponent<LevelDetails>();

		levelDetails.consoleCameraControl = this;
    }