示例#1
0
    public static bool Prefix(EModelBase __instance, Entity ___entity, Transform ___neckParentTransform, Transform ___headTransform, ref Vector3 ___lookAtPos, float ___lookAtMaxAngle,
                              ref Quaternion ___lookAtRot, Transform ___neckTransform, ref float ___lookAtBlendPer, ref float ___lookAtBlendPerTarget, bool ___lookAtIsPos)
    {
        EntityAliveSDX entityAlive = ___entity as EntityAliveSDX;

        if (!entityAlive)
        {
            return(true);
        }

        EnumEntityStunType currentStun = entityAlive.bodyDamage.CurrentStun;
        float deltaTime = Time.deltaTime;

        if (entityAlive.IsDead() || (currentStun != EnumEntityStunType.None && currentStun != EnumEntityStunType.Getup))
        {
            ___lookAtBlendPerTarget = 0f;
        }

        // If the entity has an attack target, look at them, instead of hte player.
        Entity target = EntityUtilities.GetAttackOrReventTarget(___entity.entityId);

        if (target != null)
        {
            ___lookAtBlendPerTarget -= deltaTime;
            if (target && entityAlive.CanSee(target as EntityAlive))
            {
                ___lookAtPos            = target.getHeadPosition();
                ___lookAtBlendPerTarget = 1f;
            }
        }
        if (___lookAtBlendPer <= 0f && ___lookAtBlendPerTarget <= 0f)
        {
            return(true);
        }
        ___lookAtBlendPer = Mathf.MoveTowards(___lookAtBlendPer, ___lookAtBlendPerTarget, deltaTime * 2f);

        Quaternion rotation3 = ___neckParentTransform.rotation;
        Transform  transform = ___headTransform;
        Vector3    upwards   = rotation3 * Vector3.up;
        Quaternion quaternion;

        quaternion  = Quaternion.LookRotation(___lookAtPos - Origin.position - transform.position);
        quaternion *= Quaternion.Slerp(Quaternion.identity, transform.localRotation, 0.5f);

        Quaternion b = Quaternion.RotateTowards(rotation3, quaternion, ___lookAtMaxAngle);

        ___lookAtRot = Quaternion.Slerp(___lookAtRot, b, 0.16f);
        float num = ___lookAtBlendPer;

        ___neckTransform.rotation = Quaternion.Slerp(___neckTransform.rotation, ___lookAtRot, num * 0.4f);
        Quaternion rotation2 = transform.rotation;

        transform.rotation = Quaternion.Slerp(rotation2, ___lookAtRot, num);
        return(false);
    }
    public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, Utils.EnumHitDirection _hitDirection, bool _criticalHit, float random)
    {
        this.SetRandomIndex("StunIndex");
        this.SetBool("IsStunned", true);

        this.SetInt("StunType", (int)stun);
        this.SetInt("StunBodyPart", (int)_bodyPart);
        this.SetInt("HitDirection", (int)_hitDirection);
        this.SetBool("isCritical", _criticalHit);
        this.SetFloat("HitRandomValue", random);
        this.SetTrigger("BeginStunTrigger");
        this.ResetTrigger("EndStunTrigger");
    }
示例#3
0
 public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, bool _criticalHit, float random)
 {
     //  Log("Method: " + System.Reflection.MethodBase.GetCurrentMethod().Name);
 }
示例#4
0
 // starts the Stun Animation
 public void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, bool _criticalHit,
                       float random)
 {
     SetRandomIndex("StunIndex");
     anim.SetBool("IsStunned", true);
 }
示例#5
0
 public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, Utils.EnumHitDirection _hitDirection, bool _criticalHit, float random)
 {
     SetRandomIndex("StunIndex");
     SetBool("IsStunned", true);
 }
示例#6
0
 // starts the Stun Animation
 public override void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, Utils.EnumHitDirection _hitDirection, bool _criticalHit,
                                float random)
 {
     SetRandomIndex("StunIndex");
     base.BeginStun(stun, _bodyPart, _hitDirection, _criticalHit, random);
 }
 public void BeginStun(EnumEntityStunType stun, EnumBodyPartHit _bodyPart, bool _criticalHit, float random)
 {
     // throw new NotImplementedException();
 }