Esempio n. 1
0
    void Awake()
    {
        // Get a reference to the current arena.
        arena = GameObject.FindGameObjectWithTag("Arena");
        if (arena != null)
        {
            arenaController = arena.GetComponent <ArenaController>();
        }
        else
        {
            Debug.LogError("Unable to find GameObject with tag Arena in this scene. Please add an arena, jeez.");
        }

        // Grab ref to HordeManager
        GameObject horde = GameObject.FindGameObjectWithTag("HordeManager");

        if (horde != null)
        {
            hordeManager = horde.GetComponent <HordeManager>();
        }
        else
        {
            Debug.LogError("Unable to find GameObject with tag HordeManager in this scene. Please add some enemies, jeez.");
        }

        // Instantiate the avatar for the localplayer.
        GameObject lp = Instantiate(localPlayerPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        localPlayerController       = lp.GetComponent <PlayerController>();
        localPlayerController.state = currentPlayerState;

        // Mark the time
        state.startTime = Time.time;
    }
Esempio n. 2
0
    void Update()
    {
        PlayerState  ps = gameManager.currentPlayerState;
        GameState    gs = gameManager.state;
        HordeManager hm = gameManager.hordeManager;

        UpdateUI(ps, gs, hm);
    }
Esempio n. 3
0
 void Awake()
 {
     instance            = this;
     lateralDirection    = 1;
     lateralMovement     = new Vector3(lateralSpeed, 0, 0);
     mysteryShipMovement = new Vector3(mysteryShipSpeed, 0, 0);
     goDownMovement      = new Vector3(0, -goDownSpeed, 0);
     horde          = new GameObject[enemiesRows, enemiesPerRow];
     enemiesAlive   = enemiesRows * enemiesPerRow;
     hordeFirstLine = new GameObject[enemiesPerRow];
 }
Esempio n. 4
0
    // Start is called before the first frame update
    void Start()
    {
        TurretManager turrets = Instantiate(turretManager, transform);

        turrets.name = "TurretManager";
        hordes       = Instantiate(hordeManager, transform);
        hordes.name  = "HordeManager";
        GridManager grid = Instantiate(gridManager, transform);

        grid.name = "GridManager";
        WallManager walls = Instantiate(wallManager, transform);

        walls.name = "WallManager";

        SpawnWave(waveCount);
    }
Esempio n. 5
0
    void Start()
    {
        //Se recogen los componentes necesarios del gameObject
        player = FindObjectOfType <PlayerMov>();
        bc     = gameObject.GetComponent <BoxCollider>();
        rb     = gameObject.GetComponent <Rigidbody>();

        aliens    = gameObject.GetComponentsInChildren <Alien>();
        collision = GetComponent <AudioSource>();

        hordeManager = FindObjectOfType <HordeManager>();
        scoreManager = FindObjectOfType <ScoreManager>();

        numberOfAliveAliens   = aliens.Length;  //Numero de aliens que están vivos
        initialNumberOfAliens = numberOfAliveAliens;
        initialiceAlienProperties();
        randomizeAlienHeight();
        calculateBoxCollider();
    }
Esempio n. 6
0
    void UpdateUI(PlayerState ps, GameState gs, HordeManager hm)
    {
        weapon.text = ps.weapon.name;
        ammo.text   = ps.weapon.clipAmmo + "/" + ps.weapon.ammo;

        round.text = "" + gs.round;

        health.text = ps.health + "/" + ps.maxHealth;

        score.text = "" + ps.kills;

        time.text = "" + Mathf.FloorToInt(Time.time - gs.startTime);


        spawnTimeout.text  = hm.state.spawnTimeout + "";
        numberToSpawn.text = hm.state.numberToSpawn + "";
        spawnCount.text    = hm.state.spawnCount + "";
        lastSpawn.text     = hm.state.lastSpawn + "";
        enemiescount.text  = hm.state.enemies.Count + "";
        roundStarted.text  = gs.roundStarted + "";
    }
Esempio n. 7
0
 private void Awake()
 {
     sharedInstance = this; // Instancia compartida que se puede acceder desde cualquier script
 }