Beispiel #1
0
    public bool isCounter = false; // 是否属于反击技能

    public AnimAttackData(string animName, GameObject trail, float moveDistance, float hitTime, float attackEndTime, float hitDamage,
                          float hitAngle, float hitMomentum, CriticalHitType criticalType, bool areaKnockDown, bool isFatal = false, bool isCounter = false)
    {
        this.animName = animName;
        this.trail    = trail;

        if (this.trail)
        {
            trailParenTrans = this.trail.transform.parent;

            if (this.trail.transform.Find("dust"))
            {
                dust          = this.trail.transform.Find("dust").gameObject;
                animationDust = dust.GetComponent <Animation>();
                materialDust  = dust.GetComponent <Renderer>().material;
            }

            anim = this.trail.transform.parent.GetComponent <Animation>();

            renderer = this.trail.GetComponentInChildren(typeof(Renderer)) as Renderer;
            if (renderer == null)
            {
                renderer = this.trail.GetComponentInChildren(typeof(SkinnedMeshRenderer)) as Renderer;
            }

            if (renderer == null)
            {
                material = null;
                Debug.LogError("Trail - no Material");
            }
            else
            {
                material = renderer.material;
            }
        }
        else
        {
            anim     = null;
            renderer = null;
            material = null;
        }

        this.moveDistance = moveDistance;

        this.attackEndTime  = attackEndTime;
        attackMoveStartTime = 0;
        attackMoveEndTime   = this.attackEndTime * 0.7f;

        this.hitTime        = hitTime;
        this.hitDamage      = hitDamage;
        this.hitAngle       = hitAngle;
        this.hitMomentum    = hitMomentum;
        hitCriticalType     = criticalType;
        hitAreaKnockdown    = areaKnockDown;
        useImpuls           = false;
        criticalModificator = 1;
        this.isFatal        = isFatal;
        this.isCounter      = isCounter;
    }
Beispiel #2
0
    public void ReceiveCriticalHit(Agent hitAgent, Agent attacker, CriticalHitType type, bool effectOnly /* = false*/)
    {
        if (attacker.isPlayer)
        {
            //Game.Instance.Hits += 1;
            //Game.Instance.Score += Experience;
            //Player.Instance.AddExperience(Experience, 1.5f + Game.Instance.Hits * 0.1f);
            //Game.Instance.NumberOfCriticals++;
        }

        //BlackBoard.stop = true;
        BlackBoard.health = 0;

        if (type == CriticalHitType.HORIZONTAL)
        {
            int r = Random.Range(0, 100);
            if (r < 33)
            {
                ChoppedBodyMgr1.Instance.ShowChoppedBody(agentType, hitAgent.Transform, ChoppedBodyType1.LEGS);
            }
            else if (r < 66)
            {
                ChoppedBodyMgr1.Instance.ShowChoppedBody(agentType, hitAgent.Transform, ChoppedBodyType1.BEHEADED);
            }
            else
            {
                ChoppedBodyMgr1.Instance.ShowChoppedBody(agentType, hitAgent.Transform, ChoppedBodyType1.HALF_BODY);
            }
        }
        else
        {
            float dot = Vector3.Dot(Forward, attacker.Forward);

            if (dot < 0.5 && dot > -0.5f)
            {
                ChoppedBodyMgr1.Instance.ShowChoppedBody(agentType, hitAgent.Transform, ChoppedBodyType1.SLICE_LEFT_RIGHT);
            }
            else
            {
                ChoppedBodyMgr1.Instance.ShowChoppedBody(agentType, hitAgent.Transform, ChoppedBodyType1.SLICE_FRONT_BACK);
            }
        }

        //CombatEffectsManager.Instance.PlayCriticalEffect(Transform.position, -attacker.Forward);
        //Mission.Instance.ReturnHuman(hitAgent.gameObject);
        hitAgent.gameObject.SetActive(false); // 临时这么写着
    }
Beispiel #3
0
    public AnimAttackData(string animName, GameObject trail, float moveDistance, float hitTime, float moveStartTime, float moveEndTime,
                          float attackEndTime, float hitDamage, float hitAngle, float hitMomentum, CriticalHitType criticalType, float criticalMod,
                          bool areaKnockDown, bool breakBlock, bool useImpuls, bool sloMotion)
    {
        this.animName = animName;
        this.trail    = trail;

        if (this.trail)
        {
            trailParenTrans = this.trail.transform.parent;

            if (this.trail.transform.Find("dust"))
            {
                dust          = this.trail.transform.Find("dust").gameObject;
                animationDust = dust.GetComponent <Animation>();
                materialDust  = dust.GetComponent <Renderer>().material;
            }

            anim = this.trail.transform.parent.GetComponent <Animation>();
            if (this.trail.GetComponent(typeof(Renderer)))
            {
                material = (this.trail.GetComponent(typeof(Renderer)) as Renderer).material;
            }
            else if (this.trail.GetComponentInChildren(typeof(Renderer)))
            {
                material = (this.trail.GetComponentInChildren(typeof(Renderer)) as Renderer).material;
            }
            else if (this.trail.GetComponentInChildren(typeof(SkinnedMeshRenderer)))
            {
                material = (this.trail.GetComponentInChildren(typeof(SkinnedMeshRenderer)) as Renderer).material;
            }
            else
            {
                material = null;
            }

            if (material == null)
            {
                Debug.LogError("Trail - no Material");
            }
        }
        else
        {
            anim     = null;
            material = null;
        }

        this.moveDistance = moveDistance;

        attackMoveStartTime = moveStartTime;
        attackMoveEndTime   = moveEndTime;
        this.attackEndTime  = attackEndTime;

        this.hitTime        = hitTime;
        this.hitDamage      = hitDamage;
        this.hitAngle       = hitAngle;
        this.hitMomentum    = hitMomentum;
        hitCriticalType     = criticalType;
        hitAreaKnockdown    = areaKnockDown;
        this.breakBlock     = breakBlock;
        this.useImpuls      = useImpuls;
        criticalModificator = criticalMod;
        this.sloMotion      = sloMotion;
    }