Exemple #1
0
 void Awake()
 {
     playerTag          = GetComponent <PlayerTag> ();
     movementScript     = GetComponent <Base_Player_Movement> ();
     weaponScript       = GetComponent <Base_WeaponManager> ();
     healthScript       = GetComponent <Player_Health> ();
     playerAnimator     = GetComponent <PlayerAnimator> ();
     playerEnemyHandler = GetComponent <PlayerEnemyHandler> ();
 }
Exemple #2
0
    public IEnumerator RespawnPlayer(GameObject player)
    {
        Camera.main.GetComponent <CameraController> ().TurnOnShake();
        int playerId = player.GetComponent <PlayerTag> ().Id;

        respawnTicks [playerId] = 41;

        /*Time.timeScale = .1f;
         * for (int i = 0; i < 9; i++) {
         *      yield return new WaitForSeconds (.1f);
         *      Time.timeScale += .1f;
         *      if (Time.timeScale > 1f) Time.timeScale=1f;
         * }*/
        while (respawnTicks[playerId] > 0)
        {
            yield return(new WaitForSeconds(.5f));

            respawnTicks[playerId] -= 5;
        }

        player.SetActive(true);

        Base_WeaponManager   weaponManager    = player.GetComponent <Base_WeaponManager> ();
        Player_Health        healthScript     = player.GetComponent <Player_Health> ();
        Base_Player_Movement movementScript   = player.GetComponent <Base_Player_Movement> ();
        PlayerController     playerController = player.GetComponent <PlayerController> ();

        weaponManager.RefreshWeapons();

        float tempHealth = healthScript.Health_Max;

        tempHealth = Mathf.Ceil(tempHealth * 1.33f);
        healthScript.SetHealth(tempHealth, tempHealth, 0f);

        movementScript.ResetMovementValues();
        playerController.SetInputActive(true);
        playerController.RefreshCanSwitch();
        player.transform.position = spawnPoints [playerId].position;
        healthScript.StartCoroutine(healthScript.InvincibilityRoutine(60f));
        healthScript.ResetHarsh();
        //PowerupManager powMan = player.GetComponent<PowerupManager> ();
        //powMan.Reset (); TODO

        if (gameMode != GAMEMODE.PVE || gameMode != GAMEMODE.PVP_GUNS)
        {
            player.GetComponent <PlayerEnemyHandler> ().GiveEnemy(1);
        }
    }
Exemple #3
0
 protected override void Awake()
 {
     base.Awake();
     movementScript = GetComponentInParent <Base_Player_Movement> ();
     laserSprite    = GetComponentInChildren <SpriteRenderer> ();
 }