Exemple #1
0
    public void OnEnterTrigger(GameObject obj)
    {
        if (!this.m_Armed)
        {
            return;
        }
        Being being = obj.IsPlayer() ? Player.Get() : obj.gameObject.GetComponent <Being>();

        if (being)
        {
            AI component = obj.gameObject.GetComponent <AI>();
            if (component && !component.m_Params.m_BigAnimal && !being.IsHumanAI())
            {
                return;
            }
            if (being.IsPlayer())
            {
                this.m_DamageInfo.m_Damage = this.m_PlayerDamage;
            }
            else if (being.IsHumanAI())
            {
                this.m_DamageInfo.m_Damage = this.m_HumanDamage;
            }
            else
            {
                this.m_DamageInfo.m_Damage = this.m_AnimalDamage;
            }
            being.TakeDamage(this.m_DamageInfo);
            this.Unarm(true);
        }
    }
Exemple #2
0
    public void Respawn(Being obj)
    {
        if (!obj)
        {
            return;
        }
        RespawnPoint bestRespawnPoint = this.GetBestRespawnPoint(obj.transform.position);

        DebugUtils.Assert(bestRespawnPoint, true);
        if (bestRespawnPoint)
        {
            obj.transform.position = bestRespawnPoint.transform.position;
        }
        Collider collider = obj.IsPlayer() ? Player.Get().m_Collider : General.GetComponentDeepChild <Collider>(obj.gameObject);
        Vector3  position = obj.transform.position;

        position.y += (collider ? collider.bounds.size.y : 0f);
        RaycastHit raycastHit;

        if (Physics.Raycast(position, Vector3.down, out raycastHit))
        {
            obj.transform.position = raycastHit.point;
        }
        if (obj.IsPlayer())
        {
            Vector3 vector = bestRespawnPoint ? bestRespawnPoint.transform.forward : Vector3.forward;
            vector.y = 0f;
            float   num  = Vector3.Angle(vector, Vector3.forward);
            Vector2 zero = Vector2.zero;
            if (Vector3.Dot(Vector3.right, vector) < 0f)
            {
                num *= -1f;
            }
            zero.x = num;
            Player.Get().m_FPPController.SetLookDev(zero);
            Vector3 position2 = obj.transform.position;
            position2.y           += Player.Get().GetComponent <CharacterControllerProxy>().height * 0.5f;
            obj.transform.position = position2;
        }
    }