Ejemplo n.º 1
0
    void Die()
    {
        WeaponHandling player = this.GetComponent <WeaponHandling>();

        player.dropWeapon();
        this.setLost(true);
        this.GetComponent <CapsuleCollider>().direction = 0;
        Destroy(this.gameObject, 6);
    }
Ejemplo n.º 2
0
    void Dies()
    {
        WeaponHandling player = this.GetComponent <WeaponHandling>();

        player.dropWeapon();
        this.setLost(true);
        GameObject Ragdoll = Instantiate(ragdoll, this.transform.position, this.transform.rotation);

        Ragdoll.SetActive(true);
        this.gameObject.SetActive(false);
        Destroy(this.gameObject, 6);
    }
Ejemplo n.º 3
0
 private void CheckHealth()
 {
     if (this.Healthpoints <= 0)
     {
         if (this.GetComponent <FlyBehaviour>().fly == true)
         {
             this.GetComponent <NetwrokBehaviour>().FreezePlayer();
             this.GetComponent <PlayerUI>().ScoreBoard.SetActive(true);
             GameManager.instance.Lose();
             WeaponHandling player = this.GetComponent <WeaponHandling>();
             player.dropWeapon();
             this.setLost(true);
             GameObject Ragdoll = Instantiate(ragdoll, this.transform.position, this.transform.rotation);
             Ragdoll.SetActive(true);
             SpectateTeamMate();
             Destroy(this.gameObject, 1);
             if (isServer)
             {
                 RpcDies();
             }
             else
             {
                 CmdDies();
             }
         }
         else
         {
             anim.SetTrigger("Death");
             GameManager.instance.Lose();
             Die();
             if (isServer)
             {
                 RpcDie();
             }
             else
             {
                 CmdDie();
             }
             this.GetComponent <NetwrokBehaviour>().FreezePlayer();
             this.GetComponent <PlayerUI>().ScoreBoard.SetActive(true);
             StartCoroutine(DelaySeconds());
         }
     }
 }
Ejemplo n.º 4
0
    private void OnCollisionStay(Collision collision) // Die by car run over
    {
        float minimumCollisionForce = 10f;

        if (this.gameObject.tag == "Player" && collision.gameObject.tag == "DriverPlayer" && collision.relativeVelocity.magnitude > minimumCollisionForce)
        {
            if (hasDefened)
            {
                hasDefened = false;
                return;
            }
            this.gameObject.GetComponent <Rigidbody>().constraints     = RigidbodyConstraints.FreezePositionY;
            this.gameObject.GetComponent <CapsuleCollider>().isTrigger = true;
            if (!isLocalPlayer)
            {
                return;
            }
            this.GetComponent <NetwrokBehaviour>().FreezePlayer();
            this.GetComponent <PlayerUI>().ScoreBoard.SetActive(true);
            GameManager.instance.Lose();
            WeaponHandling player = this.GetComponent <WeaponHandling>();
            player.dropWeapon();
            this.setLost(true);
            GameObject Ragdoll = Instantiate(ragdoll, this.transform.position, this.transform.rotation);
            Ragdoll.SetActive(true);
            SpectateTeamMate();
            Destroy(this.gameObject, 1);
            if (isServer)
            {
                RpcDies();
            }
            else
            {
                CmdDies();
            }
        }
    }