void Respawn()
    {
        // reset the 'we are respawning' variable
        isRespawning = false;

        // we need to be invulnerable for a little while
        MakeInvulnerable();

        Invoke("MakeVulnerable", 3);
        // show ship body again
        theMeshGO.SetActive(true);

        // revert to the first weapon
        weaponControl.SetWeaponSlot(0);

        // show the current weapon (since it was hidden when the ship explosion was shown)
        weaponControl.EnableCurrentWeapon();
    }
Ejemplo n.º 2
0
    void Respawn()
    {
        // reset the 'we are respawning' variable
        isRespawning = false;

        // reset our velocities so that we don't reposition a spinning vehicle
        myBody.velocity        = Vector3.zero;
        myBody.angularVelocity = Vector3.zero;

        // get the waypoint to respawn at from the race controller
        tempTR  = raceControl.GetRespawnWaypointTransform();
        tempVEC = tempTR.position;

        // cast a ray down from the waypoint to try to find the ground
        RaycastHit hit;

        if (Physics.Raycast(tempVEC + (Vector3.up * 300), -Vector3.up, out hit))
        {
            tempVEC.y = hit.point.y + 15;
        }

        // reposition the player at tempVEC (the waypoint position with a corrected y value via raycast)
        // and also we set the player rotation to the waypoint's rotation so that we are facing in the right
        // direction after respawning
        myTransform.rotation = tempTR.rotation;
        myTransform.position = tempVEC;

        // we need to be invulnerable for a little while
        MakeInvulnerable();

        Invoke("MakeVulnerable", 3);

        // revert to the first weapon
        if (weaponControl != null)
        {
            weaponControl.SetWeaponSlot(0);
        }
    }
Ejemplo n.º 3
0
    void Respawn()
    {
        // reset the 'we are respawning' variable
        isRespawning = false;

        // we need to be invulnerable for a little while
        MakeInvulnerable();

        Invoke("MakeVulnerable", 3);

        //set detale helth
        myDataManager.SetDetaleHealth(100);
        GameController_Tank.Instance.UpdateLivesDetaleP1(myDataManager.GetDetaleHealth());

        // show ship body again
        theMeshGO.SetActive(true);

        // revert to the first weapon
        weaponControl.SetWeaponSlot(0);

        // show the current weapon (since it was hidden when the ship explosion was shown)
        weaponControl.EnableCurrentWeapon();
    }