Ejemplo n.º 1
0
    public void Attack(Vector3 position, Actor target)
    {
        ActorCallbackData attackCallback = new ActorCallbackData();

        attackCallback.Caster = this;
        attackCallback.Target = target;
        attackCallback.Init();

        ActorAIStateAttack state = new ActorAIStateAttack();

        state.callbackData = attackCallback;
        state.Position     = position;

        SetState(state);
    }
Ejemplo n.º 2
0
    private void _onHitCallBack()
    {
        // callback data 保证只触发一次, 要么是在回调的时候,要么是在被打断的时候在destory
        if (callbackData != null && callbackData.Caster != null && callbackData.Target != null)
        {
            //Debug.Log("Renderer Forward at frame: " + Launch.battleplayer._battle.Frame + " time : " + System.Environment.TickCount );

            var data = SkillAttackFlyAttributeConfig.GetSkillAttackFlyAttribute(callbackData.Caster.AttackSkillAttackId);


            if (!data.IsFly)
            {
                // 只有击中
                AttackEffectHit hitEffect = new AttackEffectHit();

                hitEffect.EffectPrefabName = data.HitEffectName;
                hitEffect.Caster           = callbackData.Caster;
                hitEffect.Target           = callbackData.Target;

                hitEffect.Init();

                callbackData.Target.attackEffectList.Add(hitEffect);
            }
            else
            {
                // 飞行击中
                AttackEffectStraightLine attackEffect = new AttackEffectStraightLine();
                attackEffect.HitEffectPrefabName = data.HitEffectName;
                attackEffect.FlyEffectPrefabName = data.FlyEffectName;

                attackEffect.Caster = callbackData.Caster;
                attackEffect.Target = callbackData.Target;

                attackEffect.Speed = data.Speed;

                attackEffect.Init();
                callbackData.Target.attackEffectList.Add(attackEffect);
            }

            callbackData.Destroy();
            callbackData = null;
        }
    }