Exemple #1
0
    void Awake()
    {
        input        = GetComponent <PlayerInput>();
        camera       = FindObjectOfType <CameraController>();
        audioManager = FindObjectOfType <AudioManager>();

        rb           = GetComponent <Rigidbody>();
        mainCollider = GetComponent <CapsuleCollider>();

        modelTransform = GameObject.Find("PlayerModel").transform;
        animator       = modelTransform.GetComponent <Animator>();

        debugText        = GameObject.Find("debugText").GetComponent <Text>();
        hangCollider     = GameObject.Find("HangCollider").GetComponent <DelayedCollider>();
        grabArmCollider  = GameObject.Find("GrabArmCollider").GetComponent <DelayedCollider>();
        interactHintText = GameObject.Find("InteractHint").GetComponent <Text>();

        groundDetector   = new GroundDetector(transform);
        interactDetector = new InteractDetector(transform, modelTransform);
        ledgeDetector    = new LedgeDetector(transform, modelTransform);

        climbController = GetComponent <ClimbController>();

        dialogueManager = FindObjectOfType <DialogueManager>();

        currentCheckpoint = GameObject.Find(defaultCheckpoint).GetComponent <CheckpointManager>();

        livesUI = new LivesUI(lives);
    }
    public void startGame()
    {
        gameStarted = true;
        lives       = 3;
        score       = 0;
        level       = 0;
        //upperBoundPos.z = topLimit + 0.5f;
        lowerBoundPos.z = botLimit - 0.4f;
        //GameObject upperBound = Instantiate(boundary, upperBoundPos, Quaternion.identity) as GameObject;
        GameObject lowerbound = Instantiate(boundary, lowerBoundPos, Quaternion.identity) as GameObject;

        setInvaders();
        GameObject pbObj = Instantiate(playerBase, spawnpos, Quaternion.identity) as GameObject;

        pb            = pbObj.GetComponent <PlayerBase>();
        pb.controller = gameObject;
        GameObject scoreUIobj = Instantiate(scoreUI, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
        ScoreUI    s_UI       = scoreUIobj.gameObject.GetComponent <ScoreUI>();

        s_UI.controller = gameObject.GetComponent <GameController>();
        GameObject livesUIobj = Instantiate(livesUI, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;

        l_UI            = livesUIobj.gameObject.GetComponent <LivesUI>();
        l_UI.controller = gameObject.GetComponent <GameController>();
        l_UI.pb         = pb;
        createBases();
    }
Exemple #3
0
    void Start()
    {
        livesUI = GameObject.Find("HP").GetComponent <LivesUI>();

        enemy  = GetComponent <Enemy>();
        target = Waypoints.points[0];
    }
Exemple #4
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemple #5
0
 private void LoseALife()
 {
     lifeCount--;
     if (lifeCount < 0)
     {
         EventManager.RaiseOnGameOver();
         return;
     }
     LivesUI.UpdateLivesUI(lifeCount);
 }
Exemple #6
0
    void Awake()
    {
        constructTowerMenu = constructTowerMenuPublic;
        turretDetailMenu   = turretDetailMenuPublic;
        currencyUI         = currencyUIPublic;
        messageUI          = messageUIPublic;
        livesUI            = livesUIPublic;
        winLoseUI          = winLoseUIPublic;

        menus = new Menu[] { constructTowerMenu, turretDetailMenu };
    }
 private static void UpdateLivesUI()
 {
     LivesUI.UpdateText(Lives + " LIVES");
 }
	void Awake(){

		sessionManager = SessionManager.Instance;
		sessionManager.psInfo.LevelReset();
		
		playerSpawnVectors = new List<Vector3>();

		foreach(Transform location in spawnPositions){
			playerSpawnVectors.Add(location.position);
		}
		hudTools = GetComponent<HUDTools>();
		playersReady = new List<NetworkPlayer>();
		allTimedSpawns = new HeapPriorityQueue<PowerSpawn>(30);


		powerPrefabs = GetComponent<PowerPrefabs>();
		GameObject placementRoot = Instantiate(placementRootPrefab, 
		                                       placementRootPrefab.transform.position, Quaternion.identity) as GameObject;
		placementUI = placementRoot.GetComponent<PlacementUI>();
		timer = GameObject.Find("timer").GetComponent<Timer>();
		timer.Hide();

		ScoreUI scoreUI = placementRoot.GetComponent<ScoreUI>();
		scoreUI.Initialize(sessionManager.psInfo);

		livesUI = placementRoot.GetComponent<LivesUI>();
		livesUI.Initialize(sessionManager.psInfo, sessionManager.psInfo.livesPerRound);

		pointTracker = GetComponent<PointTracker>();
		pointTracker.Initialize(scoreUI);


	}
Exemple #9
0
 private void Awake()
 {
     Current  = this;
     numLives = Player.Current.numberOfLives;
     InitHearts();
 }