Пример #1
0
    //自己表现
    void UseSelfGo(RoleBase[] target)
    {
        GameObject fightRole  = owner.fightRole;
        Vector3    orPosition = fightRole.transform.position;

        //表示作用范围
        int length = target.Length;

        //此时1个目标
        if (length == 1)
        {
            var oneTarget = target[0];

            if (oneTarget == null)
            {
                EndUse();
            }
            else
            {
                fightRole.transform.DOMove(owner.GetTargetPosition(oneTarget), ConstConfig.moveSpeed).OnComplete(
                    () =>
                {
                    fightRole.transform.DOMove(orPosition, ConstConfig.moveSpeed).OnComplete(() => { EndUse(); });

                    UseEnemyEffect(oneTarget); //特效

                    UseEnemyGo(oneTarget);

                    UseData(owner, oneTarget); //数据
                }
                    );
            }
        }
        //此时多个目标
        else if (length > 1)
        {
            //影响目标数据
            for (int i = 0; i < target.Length; i++)
            {
                var role = target[i];
                if (role == null)
                {
                    continue;
                }

                UseEnemyEffect(role); //特效

                UseEnemyGo(role);

                UseData(owner, role); //数据
            }
            TimeManager.RegistOneTime((id) => { EndUse(); }, targetTime);

            //
        }
    }