コード例 #1
0
ファイル: AttackState.cs プロジェクト: daxingyou/client-2
    private void OnPlayHitHandler()
    {
        if (Target == null)
        {
            return;
        }
        if (actionInfo != null && AnimationType.IsAttackAction(actionInfo.ActionName))
        {
            if (!actionInfo.IsLangAttack)
            {
                if (actionInfo.IsHitMove && actionInfo.HitMoveDistance > 0f && actionInfo.HitMoveTime > 0f)
                {
                    target.DoHitMove(creature.GetPosition(), actionInfo.HitMoveDistance, actionInfo.HitMoveTime);
                }
                else if (actionInfo.IsHitFly && actionInfo.HitFlyDistance > 0f && actionInfo.HitFlyTime > 0f)
                {
                    target.DoHitFly(creature.GetPosition(), actionInfo.HitFlyDistance, actionInfo.HitFlyTime);
                }
                else
                {
                    target.DoHit();
                }
            }
            else
            {
                for (int i = 0; i < actionInfo.ActionEffectInfos.Count; ++i)
                {
                    EffectInfo effectInfo = actionInfo.ActionEffectInfos[i];
                    if (effectInfo.EffectType == EffectTypes.Bullet)
                    {
                        BulletEntity bulletEntity = new BulletEntity();

                        Transform bron = creature.Model.GetChild(effectInfo.BindName);
                        if (bron != null)
                        {
                            bulletEntity.ID              = Entity.UniqueID;
                            bulletEntity.OwnerId         = creature.ID;
                            bulletEntity.TargetId        = Target.ID;
                            bulletEntity.HitFly          = actionInfo.IsHitFly;
                            bulletEntity.HitFlyDistance  = actionInfo.HitFlyDistance;
                            bulletEntity.HitFlyTime      = actionInfo.HitFlyTime;
                            bulletEntity.HitMove         = actionInfo.IsHitMove;
                            bulletEntity.HitMoveDistance = actionInfo.HitMoveDistance;
                            bulletEntity.HitMoveTime     = actionInfo.HitMoveTime;
                            Vector3 pos  = Target.Model.GetChild(BoneTypes.CenterPoint).position;
                            Vector3 pos1 = Target.Container.transform.TransformDirection(Vector3.back * 5f);
                            pos1.y = pos.y;
                            bulletEntity.Play(bron.position, pos + pos1, effectInfo.FlySpeed, effectInfo.EffectName, effectInfo.EffectName, effectInfo.SoundName, effectInfo.SoundPlayDelayTime);
                        }
                    }
                }
            }
        }
    }
コード例 #2
0
    private void OnDelHandler(float del)
    {
        Alert.Hide();
        TimerManager.RemoveHandler(tTimerInfo);
        tTimerInfo = null;
        tCreature.SetPosition(0f, 0f, 0f);
        Vector3 pos = tCreature.Container.transform.position + tCreature.Container.transform.TransformDirection(currentActionInfo.AttackRadius * Vector3.forward);

        beAttacker.SetPosition(pos.x, pos.y, pos.z);
        beAttacker.FaceTo(tCreature.GetPosition());
        if (AnimationType.IsAttackAction(currentActionInfo.ActionName))
        {
            beAttacker.Show();
            tCreature.DoAttack(beAttacker, currentActionInfo);
        }
        else
        {
            beAttacker.Hide();
            tCreature.PlayAnimation(currentActionInfo.ActionName, true, null, OnEndHandler);
        }
    }