Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        MenuInteracts = new List <MenuInteract>(textColliders.Count);
        if (textColliders.Count == 0)
        {
            Debug.Log("Please add objects onto the ActivateText Script, it is on the canvas object.");
        }
        else
        {
            foreach (GameObject gO in textColliders)
            {
                MenuInteract mI = gO.GetComponent <MenuInteract>();
                MenuInteracts.Add(mI);
            }
        }

        GameObject textObj1 = transform.GetChild(0).gameObject;

        title = textObj1.GetComponent <Text>();

        GameObject textObj2 = transform.GetChild(1).gameObject;

        screenText = textObj2.GetComponent <Text>();
    }
 // Use this for initialization
 void Start()
 {
     mainCamera       = GameObject.Find("Camera (eye)");
     restingTransform = this.transform.rotation;
     menuInteract     = GetComponent <MenuInteract>();
 }
Exemplo n.º 3
0
    private void Awake()
    {
        //Get controllers
        me = this;

        canvasObject  = GameObject.Find("GeneralCanvas");
        canvasManager = canvasObject.GetComponent <CanvasManager>();
        menuInteract  = canvasObject.GetComponent <MenuInteract>();

        playerObject     = GameObject.Find("FirstPersonPlayer");
        playerBody       = playerObject.GetComponent <CharacterController>();
        playerController = playerObject.GetComponent <PlayerController>();
        playerCam        = playerObject.GetComponentInChildren <Camera>();
        playerView       = playerObject.GetComponentInChildren <PlayerView>();
        audioManager     = FindObjectOfType <AudioManager>();
        dialogManager    = FindObjectOfType <DialogManager>();
        slotsController  = FindObjectOfType <SlotsController>();


        canvasManager.gameManager  = me;
        canvasManager.menuInteract = menuInteract;
        menuInteract.canvasManager = canvasManager;

        //Get game objects
        miniMapCam           = GameObject.Find("MinimapCam").GetComponent <Camera>();
        miniMapController    = miniMapCam.GetComponent <MiniMapController>();
        gearsInLevel         = GameObject.Find("GearsInLevel");
        shopObject           = GameObject.Find("Shop");
        initialGearPosition1 = GameObject.Find("InitialGear1").transform.position;
        initialGearPosition2 = GameObject.Find("InitialGear2").transform.position;
        initialGearPosition3 = GameObject.Find("InitialGear3").transform.position;
        gearPosition1        = GameObject.Find("Gear1Position").transform.position;
        gearPosition2        = GameObject.Find("Gear2Position").transform.position;
        gearPosition3        = GameObject.Find("Gear3Position").transform.position;
        gearPosition4        = GameObject.Find("Gear4Position").transform.position;
        bossPandaPosition    = GameObject.Find("BossPandaSpawnPoint").transform.position;
        bossMammothPosition  = GameObject.Find("BossMammothSpawnPoint").transform.position;

        level1 = GameObject.Find("Level1").GetComponent <LevelBuilder>();
        level2 = GameObject.Find("Level2").GetComponent <LevelBuilder>();

        introCinematique = FindObjectOfType <VideoPlayer>();

        gearSlot1 = GameObject.Find("GearSlot1");
        gearSlot2 = GameObject.Find("GearSlot2");
        gearSlot3 = GameObject.Find("GearSlot3");

        //Get HUD
        barArmor  = GameObject.Find("Armor Bar").GetComponent <HUDBar>();
        barHealth = GameObject.Find("Health Bar").GetComponent <HUDBar>();

        textArmor  = GameObject.Find("Current Armor").GetComponent <HUDText>();
        textHealth = GameObject.Find("Current Health").GetComponent <HUDText>();
        textMoney  = GameObject.Find("Current Money").GetComponent <HUDText>();

        weaponHUD     = GameObject.Find("HUDWeapon");
        textMunitions = GameObject.Find("Munitions").GetComponent <HUDText>();
        textCapacity  = GameObject.Find("Capacity").GetComponent <HUDText>();
        weaponHUD.SetActive(false);
        consumableHUD            = GameObject.Find("HUDConsumable");
        textConsumablesRemaining = consumableHUD.GetComponentInChildren <HUDText>();
        consumableHUD.SetActive(false);

        textSlot1 = GameObject.Find("TextSlot 1").GetComponent <HUDText>();
        textSlot2 = GameObject.Find("TextSlot 2").GetComponent <HUDText>();
        textSlot3 = GameObject.Find("TextSlot 3").GetComponent <HUDText>();

        //Get Teleporters

        tpToLevel1FromTuto = GameObject.Find("tpToLevel1FromTuto").transform;
        tpToTutoFromLevel1 = GameObject.Find("tpToTutoFromLevel1").transform;

        tpToLevel1FromArena1 = GameObject.Find("tpToLevel1FromArena1").transform;

        tpToMarketFromArena1 = GameObject.Find("tpToMarketFromArena1").transform;
        tpToMarketFromArena1.gameObject.SetActive(false);
        tpToArena1FromMarket = GameObject.Find("tpToArena1FromMarket").transform;

        tpToLevel2FromMarket = GameObject.Find("tpToLevel2FromMarket").transform;
        tpToMarketFromLevel2 = GameObject.Find("tpToMarketFromLevel2").transform;

        tpToLevel2FromArena2 = GameObject.Find("tpToLevel2FromArena2").transform;

        introCinematique.Play();

        //Set Layer Masks

        groundMask  = 256;
        enemiesMask = 512;
        playerMask  = 1024;
        gearMask    = 2048;
        tpMask      = 4096;
        npcMask     = 8192;

        playerSpawnPoint = playerController.transform.position;


        InitializePlayer();
        dialogManager.gameManager   = me;
        playerView.gameManager      = me;
        miniMapController.player    = playerBody.transform;
        slotsController.gameManager = me;
        gearsInGame = new List <GearController>();
        enemies     = new List <EnemyStats>();
        npcInGame   = new List <NPC>();



        EnemyStats[] initialEnemies = FindObjectsOfType <EnemyStats>();

        foreach (EnemyStats enemy in initialEnemies)
        {
            InitializeEnemy(enemy);
        }

        NPC[] initialNPCs = FindObjectsOfType <NPC>();

        foreach (NPC npc in initialNPCs)
        {
            InitializeNPC(npc);
        }

        canvasManager.InitiateCanvas(playerController);
        StartCoroutine("CheckIfIntroFinished");
    }