Esempio n. 1
0
 public virtual void    UpdateTeleport()
 {
     if (GetCurrentHP() <= 0)
     {
         tpInfo.ForEach(delegate(TeleportInfo info)
         {
             if (info.TeleportState)
             {
                 RemoveDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_TELEPORT);
             }
         });
         tpInfo.Clear();
     }
     else
     {
         for (int index = 0; index < tpInfo.Count;)
         {
             TeleportInfo info = tpInfo[index];
             if (info.MoveTime > 0.0f)
             {
                 info.MoveTime -= Time.deltaTime;
                 ++index;
             }
             else
             {
                 if (info.TeleportState)
                 {
                     RemoveDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_TELEPORT);
                 }
                 tpInfo.RemoveAt(index);
             }
         }
     }
 }
Esempio n. 2
0
        /*public int index;
         *
         * public bool MobTeleport = false;
         *
         * private GhostTeleport ghostTeleport;*/

        public void SetValues(TeleportWindow teleportWindow, TeleportInfo teleportInfo)
        {
            this.teleportWindow = teleportWindow;
            TeleportInfo        = teleportInfo;

            SetTeleportButtonText($"{TeleportInfo.text}/n{TeleportInfo.position}");
        }
Esempio n. 3
0
    public override void SetTeleportInfo(TeleportInfo info)
    {
        tpInfo.Add(info);
        float  distance  = info.MoveSpeed * info.MoveTime;
        string knockback = "";

        if (distance < 3.0f)
        {
            knockback = "knockslide01_004";
        }
        else if (distance < 6.0f)
        {
            knockback = "knockslide02_004";
        }
        else
        {
            knockback = "knockslide03_003";
        }
        int random = UnityEngine.Random.Range(0, 10000);

        if (random < info.PlayActionProbality)
        {
            if (mAnimController != null && AnimController[knockback] != null)
            {
                AnimationState animState = AnimController[knockback];
                animState.wrapMode = WrapMode.Once;
                animState.layer    = 13;
                mAnimController.Play(knockback);
            }
        }
        if (info.TeleportState)
        {
            AddDebuffState(HeaderProto.ECreatureActionState.CREATURE_ACTION_STATE_TELEPORT);
        }
    }
Esempio n. 4
0
        // these frames only happen if we are not paused / scrolling
        public void Update()
        {
            foreach (JoinHandler join in joins)
            {
                if (join.Trigger(playerPos.Position))
                {
                    if (JoinTriggered != null)
                    {
                        JoinTriggered(join);
                    }
                    return;
                }
            }

            // check for teleports
            for (int i = 0; i < Screen.Teleports.Count; i++)
            {
                TeleportInfo teleport = Screen.Teleports[i];

                if (teleportEnabled[i])
                {
                    if (Math.Abs(playerPos.X - teleport.From.X) <= 2 && Math.Abs(playerPos.Y - teleport.From.Y) <= 8)
                    {
                        if (Teleport != null)
                        {
                            Teleport(teleport);
                        }
                        break;
                    }
                }
                else if (Math.Abs(playerPos.X - teleport.From.X) >= 16 || Math.Abs(playerPos.Y - teleport.From.Y) >= 16)
                {
                    teleportEnabled[i] = true;
                }
            }

            if (isAutoscrolling)
            {
                if (OffsetX >= Screen.PixelWidth - Game.CurrentGame.PixelsAcross)
                {
                    offsetXF = Screen.PixelWidth - Game.CurrentGame.PixelsAcross;
                }
                else
                {
                    offsetXF += autoscrollSpeed;
                }
            }
            else if (autoscrollX.HasValue)
            {
                if (playerPos.X >= autoscrollX.Value)
                {
                    isAutoscrolling = true;
                }
            }

            EnforcePlayerBounds();
        }
Esempio n. 5
0
        public int BeginTeleport(int entityId, Vector3 target)
        {
            int id;

            do
            {
                id = _randomProvider.NextInt();
            } while (_teleportIds.ContainsKey(id));

            _teleportIds[id] = new TeleportInfo(entityId, target);
            return(id);
        }
Esempio n. 6
0
        private void GenerateButton(TeleportInfo entry)
        {
            GameObject button         = Instantiate(buttonTemplate);
            var        teleportButton = button.GetComponent <TeleportButton>();

            teleportButton.SetValues(this, entry);

            button.transform.SetParent(buttonTemplate.transform.parent, false);
            button.SetActive(true);

            TeleportButtons.Add(teleportButton.gameObject);
        }
Esempio n. 7
0
 public void ButtonClicked(TeleportInfo info)
 {
     onTeleportRequested?.Invoke(info);
     if (PlayerManager.LocalPlayer.TryGetComponent <GhostOrbit>(out var orbit) == false)
     {
         return;
     }
     orbit.CmdStopOrbiting();
     if (OrbitOnTeleport == false)
     {
         return;
     }
     orbit.CmdServerOrbit(info.gameObject);
 }
    public void Teleport()
    {
        // instead of a for each loop we could put all of the teleporters in a dictionary maped to there Id but that wouldnt work
        // for teleporting in the same scene because all the keys need to be unique. maybe a dictionary with lists of teleporters that are looped through.
        foreach (GameObject go in Teleporters[lastTeleporter.id])

        {
            Teleport tp = go.GetComponent <Teleport>();

            if (tp.info.id == lastTeleporter.id && tp.info != lastTeleporter)
            {
                lastTeleporter = null;
                // facing is a string containing a direction that the animation should be... not used currently just set.
                //player.facing = tp.info.facing;

                //if the player is on the teleport zone it will call OnEnterTrigger2D and be stuck in an endless loop.
                //so we move it over depending on the teleporters facing string.
                Vector3 facing = new Vector3(0f, 0f, 0f);

                switch (tp.info.facing)
                {
                case Facing.Up:
                    facing.y = 1.1f;
                    break;

                case Facing.Down:
                    facing.y = -1.1f;
                    break;

                case Facing.Left:
                    facing.x = -1.1f;
                    break;

                case Facing.Right:
                    facing.x = 1.1f;
                    break;

                default:
                    break;
                }

                player.transform.position = go.transform.position + facing;

                //Once we find the teleporter we were looking for, and after we move the player we break out of the foreach loop
                //so were not needlessly looping though the rest of the teleporters in that Scene.
                break;
            }
        }
    }
Esempio n. 9
0
        private void OnTeleportButtonPress(TeleportInfo info)
        {
            if (aiPlayer.OnCoolDown(NetworkSide.Client))
            {
                return;
            }
            aiPlayer.StartCoolDown(NetworkSide.Client);

            if (info.gameObject.GetComponent <PlayerScript>() != null || info.gameObject.GetComponent <MobAI>() != null)
            {
                aiPlayer.CmdTrackObject(info.gameObject);
                return;
            }

            aiPlayer.CmdTeleportToCamera(info.gameObject, true);
        }
    public void Teleport()
    {
        // instead of a for each loop we could put all of the teleporters in a dictionary maped to there Id but that wouldnt work 
        // for teleporting in the same scene because all the keys need to be unique. maybe a dictionary with lists of teleporters that are looped through.
        foreach (GameObject go in Teleporters[lastTeleporter.id])

        {

            Teleport tp = go.GetComponent<Teleport>();

            if (tp.info.id == lastTeleporter.id && tp.info != lastTeleporter)
            {
                lastTeleporter = null;
                // facing is a string containing a direction that the animation should be... not used currently just set.
                //player.facing = tp.info.facing;

                //if the player is on the teleport zone it will call OnEnterTrigger2D and be stuck in an endless loop.
                //so we move it over depending on the teleporters facing string.
                Vector3 facing = new Vector3(0f, 0f, 0f);

                switch (tp.info.facing)
                {
                    case Facing.Up:
                        facing.y = 1.1f;
                        break;
                    case Facing.Down:
                        facing.y = -1.1f;
                        break;
                    case Facing.Left:
                        facing.x = -1.1f;
                        break;
                    case Facing.Right:
                        facing.x = 1.1f;
                        break;
                    default:
                        break;
                }

                player.transform.position = go.transform.position + facing;

                //Once we find the teleporter we were looking for, and after we move the player we break out of the foreach loop
                //so were not needlessly looping though the rest of the teleporters in that Scene.
                break;
            }
        }
    }
    void GetTeleporters()
    {
        Teleporters.Clear();

        GameObject[] x = GameObject.FindGameObjectsWithTag("Teleport");

        foreach (GameObject tp in x)
        {
            TeleportInfo info = tp.GetComponent <Teleport>().info;

            if (Teleporters.ContainsKey(info.id))
            {
                Teleporters[info.id][1] = tp;
            }
            else
            {
                Teleporters[info.id]    = new GameObject[2];
                Teleporters[info.id][0] = tp;
            }
        }
    }
Esempio n. 12
0
    public virtual void Load(BinaryHelper helper)
    {
        ID         = helper.ReadInt();
        SceneMapX  = helper.ReadFloat();
        SceneMapY  = helper.ReadFloat();
        IconMapX   = helper.ReadFloat();
        IconMapY   = helper.ReadFloat();
        DeviationX = helper.ReadFloat();
        DeviationY = helper.ReadFloat();
        IconPath   = helper.ReadString();
        int resultCount = helper.ReadInt();

        TeleporterList = new TeleportInfo[resultCount];
        for (int index = 0; index < resultCount; ++index)
        {
            TeleporterList[index] = new TeleportInfo();
            for (int innerIndex = 0; innerIndex < TeleporterList[index].ParamList.Length; ++innerIndex)
            {
                TeleporterList[index].ParamList[innerIndex] = helper.ReadFloat();
            }
        }
    }
Esempio n. 13
0
        private static void Teleport_OnTeleport(Obj_AI_Base sender, Teleport.TeleportEventArgs args)
        {
            var caster = sender as AIHeroClient;

            if (caster == null)
            {
                return;
            }

            var info = new TeleportInfo(caster, args);

            if (args.Status == TeleportStatus.Start)
            {
                if (!DetectedTeleports.Contains(info))
                {
                    Print(caster, args);
                }
            }
            else
            {
                Print(caster, args);
            }
        }
Esempio n. 14
0
        public static void RecallBarDraw(Obj_AI_Base sender, TeleportInfo tp)
        {
            Rect(X + X2, Y + Y2, Width, Height, 3, Color.White);
            if (tp == null)
            {
                return;
            }

            var c = Color.GreenYellow.ToSystem();

            if (tp.Sender.IsEnemy)
            {
                c = Color.Red.ToSystem();
            }
            var text       = sender.BaseSkinName;
            var textlength = text.Length * 12;

            Drawing.DrawText(startpoint.X - textlength, startpoint.Y - Scale * tp.TimeLeft - 10, c, text);

            var linex = startpoint.X - 20;
            var liney = startpoint.Y - Scale * tp.TimeLeft - 3;

            Drawing.DrawLine(linex + 20, liney, linex, liney, 3, c);
        }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AetheryteEntry"/> class.
 /// </summary>
 /// <param name="data">Data read from the Aetheryte List.</param>
 internal AetheryteEntry(TeleportInfo data)
 {
     this.data = data;
 }
Esempio n. 16
0
 void Awake()
 {
     info = new TeleportInfo(TeleportID, SceneName, facing);
 }
Esempio n. 17
0
 public void ButtonClicked(TeleportInfo info)
 {
     onTeleportRequested?.Invoke(info);
 }
Esempio n. 18
0
    public static bool    Do(sdActorInterface actor, OpParameter param)
    {
        Hashtable table = sdConfDataMgr.Instance().GetTable("operation");

        Operation op = (Operation)table[param.id];

        switch (op.byOperationType)
        {
        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_NONE: {
            return(true);
        }

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_FOREVER: {
            if (param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_START ||
                param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_ADD
                )
            {
                if (actor == null)
                {
                    return(false);
                }
                Hashtable dst = actor.GetProperty();
                switch (op.dwOperationPara1)
                {
                case (int)HeaderProto.EOpreationFlag.OPREATION_FLAG_ADD: {
                    AddProperty(actor, dst, op, param);
                } break;

                case (int)HeaderProto.EOpreationFlag.OPREATION_FLAG_REDUCE: {
                    param.data = -param.data;
                    AddProperty(actor, dst, op, param);
                } break;

                case (int)HeaderProto.EOpreationFlag.OPREATION_FLAG_SET: {} break;
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_STATE: {
            if (actor == null)
            {
                return(false);
            }
            if (param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_START)
            {
                HeaderProto.ECreatureActionState state = (HeaderProto.ECreatureActionState)param.data;
                actor.AddDebuffState(state);
            }
            else if (param.doType == (int)HeaderProto.EDoOperationType.DO_OPERATION_TYPE_REMOVE)
            {
                HeaderProto.ECreatureActionState state = (HeaderProto.ECreatureActionState)param.data;
                actor.RemoveDebuffState(state);
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_ADD_BUFF: {
            if (actor == null)
            {
                return(false);
            }
            actor.AddBuff(param.data, param.data1, param.attackActor);
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_DISPEL: {
            if (actor == null)
            {
                return(false);
            }
            if (op.dwOperationPara0 == 0)
            {
                actor.RemoveBuffbyClassType(op.dwOperationPara1);
            }
            else if (op.dwOperationPara0 == 1)
            {
                actor.RemoveBuff(op.dwOperationPara1, op.dwOperationPara2);
            }
            else if (op.dwOperationPara0 == 2)
            {
                actor.RemoveBuffbyID(param.data);
            }
            else if (op.dwOperationPara0 == 3)
            {
                actor.RemoveBuffbyProperty(op.dwOperationPara1);
            }
            else if (op.dwOperationPara0 == 4)
            {
            }
            else if (op.dwOperationPara0 == 5)
            {
                actor.RemoveAllBuff();
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_DO_BUFF_DAMAGE:
        {
            if (param.targetActor == null)
            {
                return(false);
            }
            Hashtable action = sdConfDataMgr.Instance().m_BuffAction[param.data]       as Hashtable;

            int strikeType = (int)action["byAoeAreaType"];
            int nCombo     = 0;
            if (strikeType == 0)
            {
                HeaderProto.ESkillEffect skilleffect = HeaderProto.ESkillEffect.SKILL_EFFECT_DAMAGE_HP;
                if (action.ContainsKey("bySkillEffect"))
                {
                    skilleffect = (HeaderProto.ESkillEffect)(action["bySkillEffect"]);
                }
                action["ParentID"] = 0;
                DamageResult dr = sdGameLevel.instance.battleSystem.testHurt(param.attackActor,
                                                                             action,
                                                                             param.targetActor,
                                                                             0,
                                                                             skilleffect);
                if (Bubble.IsHurtOther(dr.bubbleType))
                {
                    nCombo++;
                }
            }
            else
            {
                nCombo = sdGameLevel.instance.battleSystem.DoSDAttack(
                    param.attackActor,
                    action,
                    param.targetActor.transform.position,
                    0,
                    null);
            }
            if (param.attackActor == sdGameLevel.instance.mainChar && nCombo > 0)
            {
                sdUICharacter.Instance.ShowComboWnd(true, nCombo);
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_CLEAR_SKILL_COOLDOWN:
        {
            sdGameActor gameActor = (sdGameActor)actor;
            if (op.dwOperationPara0 == 0)                    //某个技能aa
            {
                int     skillID = param.data / 100;
                sdSkill skill   = gameActor.skillTree.getSkill(skillID);
                if (skill != null)
                {
                    if (op.dwOperationPara1 == 0)
                    {
                        skill.skillState = (int)sdSkill.State.eSS_OK;
                    }
                    else if (op.dwOperationPara1 == 1)
                    {
                        int time = CalculateSkillCoolDown(op.dwOperationPara2, op.dwOperationPara3, skill.GetCD(), param.data1);
                        sdUICharacter.Instance.SetShortCutCd(param.data, time, true);
                        skill.cooldown = time;
                        skill.Setct(0.0f);
                    }
                }
            }
            else if (op.dwOperationPara0 == 1)                   //某种形态的技能aa
            {
                foreach (DictionaryEntry de in gameActor.skillTree.AllSkill)
                {
                    sdSkill skill = de.Value as sdSkill;
                    if (skill.skillProperty.ContainsKey("byShape"))
                    {
                        int byShape = (int)skill.skillProperty["byShape"];
                        if (byShape == param.data)
                        {
                            if (op.dwOperationPara1 == 0)
                            {
                                skill.skillState = (int)sdSkill.State.eSS_OK;
                            }
                            else if (op.dwOperationPara1 == 1)
                            {
                                int time = CalculateSkillCoolDown(op.dwOperationPara2, op.dwOperationPara3, skill.cooldown, param.data1);
                                sdUICharacter.Instance.SetShortCutCd(skill.id, time, true);
                                skill.cooldown = time;
                                skill.Setct(0.0f);
                            }
                        }
                    }
                }
            }
            else if (op.dwOperationPara0 == 2)                   //所有技能aa
            {
                foreach (DictionaryEntry de in gameActor.skillTree.AllSkill)
                {
                    sdSkill skill = de.Value as sdSkill;
                    if (op.dwOperationPara1 == 0)
                    {
                        skill.skillState = (int)sdSkill.State.eSS_OK;
                    }
                    else if (op.dwOperationPara1 == 1)
                    {
                        int time = CalculateSkillCoolDown(op.dwOperationPara2, op.dwOperationPara3, skill.cooldown, param.data1);
                        sdUICharacter.Instance.SetShortCutCd(skill.id, time, true);
                        skill.cooldown = time;
                        skill.Setct(0.0f);
                    }
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_SUMMON_MONSTER:                  //operator.txt byOperationType
        {
            iSummonUniqueID++;
            if (op.dwOperationPara0 == 1)
            {
                int     iAngle       = op.dwOperationPara2;
                int     iSummonID    = param.data;
                int     iSommonCount = param.data1;
                int     skillID      = param.data2;
                Vector3 v            = param.attackActor.GetDirection();
                v.y = 0.0f;
                v.Normalize();
                Quaternion tempQ = Quaternion.FromToRotation(new Vector3(0, 0, 1), v);
                if (v.z < -0.9999f)
                {
                    tempQ = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
                }

                List <sdActorInterface> lstActor = null;
                if (op.dwOperationPara3 == 1 || op.dwOperationPara3 == 2)                        //1 方向并跟踪目标  2.方向不跟踪aaa
                {
                    List <sdActorInterface> actorList = null;
                    if (iAngle == 360)
                    {
                        actorList = sdGameLevel.instance.actorMgr.FindActor(
                            param.attackActor,
                            HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                            param.attackActor.transform.position,
                            Vector3.zero,
                            1,
                            0,
                            15.0f,
                            true);
                    }
                    else
                    {
                        actorList = sdGameLevel.instance.actorMgr.FindActor(
                            param.attackActor,
                            HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                            param.attackActor.transform.position,
                            param.attackActor.GetDirection(),
                            5,
                            iAngle,
                            15.0f,
                            true);
                    }
                    lstActor = sdGameLevel.instance.actorMgr.SortActor(param.attackActor.transform.position, actorList);
                }

                int i = 0;
                if (op.dwOperationPara3 == 1)
                {
                    for (; i < iSommonCount && i < lstActor.Count; i++)
                    {
                        sdActorInterface target  = lstActor[i];
                        SummonInfo       sumInfo = new SummonInfo();
                        Vector3          vDir    = target.transform.position - param.attackActor.transform.position;
                        vDir.y = 0.0f;
                        vDir.Normalize();
                        if (v.z < -0.99999f)
                        {
                            sumInfo.rotate = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
                        }
                        else
                        {
                            sumInfo.rotate = Quaternion.FromToRotation(new Vector3(0, 0, 1), vDir);
                        }
                        sumInfo.pos      = param.trans.position;
                        sumInfo.userdata = target;
                        sumInfo.summonID = iSummonID;
                        sumInfo.skillID  = skillID;
                        param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                    }
                }
                else if (op.dwOperationPara3 == 2)
                {
                    for (; i < iSommonCount && i < lstActor.Count; i++)
                    {
                        sdActorInterface target = lstActor[i];
                        Vector3          vDir   = target.transform.position - param.attackActor.transform.position;
                        vDir.y = 0.0f;
                        vDir.Normalize();
                        SummonInfo sumInfo = new SummonInfo();
                        if (v.z < -0.99999f)
                        {
                            sumInfo.rotate = Quaternion.AngleAxis(180.0f, new Vector3(0, 1, 0));
                        }
                        else
                        {
                            sumInfo.rotate = Quaternion.FromToRotation(new Vector3(0, 0, 1), vDir);
                        }
                        sumInfo.pos      = param.trans.position;
                        sumInfo.summonID = iSummonID;
                        sumInfo.skillID  = skillID;
                        param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                    }
                }
                if (i < iSommonCount)
                {
                    if (iAngle == 360)
                    {
                        float iPerAngle = (float)iAngle / (float)(iSommonCount - i);
                        for (int j = 0; j < iSommonCount - i; j++)
                        {
                            SummonInfo sumInfo = new SummonInfo();
                            sumInfo.rotate   = Quaternion.AngleAxis(iPerAngle * j, new Vector3(0, 1, 0)) * tempQ;
                            sumInfo.pos      = param.trans.position;
                            sumInfo.summonID = iSummonID;
                            sumInfo.skillID  = skillID;
                            param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                        }
                    }
                    else
                    {
                        float iPerAngle   = (float)iAngle / (float)(iSommonCount - i + 1);
                        float iAngleStart = -iAngle * 0.5f + iPerAngle;
                        for (int j = 0; j < iSommonCount - i; j++)
                        {
                            SummonInfo sumInfo = new SummonInfo();
                            sumInfo.rotate   = Quaternion.AngleAxis(iAngleStart + iPerAngle * j, new Vector3(0, 1, 0)) * tempQ;
                            sumInfo.pos      = param.trans.position;
                            sumInfo.summonID = iSummonID;
                            sumInfo.skillID  = skillID;
                            param.attackActor.AddSummon(sumInfo, iSummonUniqueID);
                        }
                    }
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_TELEPORT:
        {
            TeleportInfo tpInfo = new TeleportInfo();
            tpInfo.Type = op.dwOperationPara0;
            tpInfo.PlayActionProbality = op.dwOperationPara1;
            tpInfo.TeleportState       = (op.dwOperationPara2 == 1);
            tpInfo.MoveSpeed           = (float)param.data * 0.001f;
            tpInfo.MoveTime            = (float)param.data1 * 0.001f;
            tpInfo.castActor           = param.attackActor;
            tpInfo.castCenter          = param.attackActor.transform.position;
            if (actor != null)
            {
                actor.SetTeleportInfo(tpInfo);
            }
            else
            {
                float dis = tpInfo.MoveSpeed * tpInfo.MoveTime;
                List <sdActorInterface> lstActor = sdGameLevel.instance.actorMgr.FindActor(param.attackActor, HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY, tpInfo.castCenter, Vector3.zero, 1, 0, dis, true);
                if (lstActor != null)
                {
                    foreach (sdActorInterface a in lstActor)
                    {
                        a.SetTeleportInfo(tpInfo);
                    }
                }
            }
        } break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_DOACTION:
        {
            sdGameActor gameActor = (sdGameActor)(param.attackActor);
            sdBaseState baseState = (sdBaseState)gameActor.logicTSM.states[param.data];
            if (baseState != null)
            {
                int nCombo = sdGameLevel.instance.battleSystem.DoSDAttack(gameActor, baseState.stateData, gameActor.transform.position, 0, baseState);
                baseState.playEffectNow(gameActor);
                baseState.PlayAudioNow(gameActor);
                if (gameActor == sdGameLevel.instance.mainChar && nCombo > 0)
                {
                    sdUICharacter.Instance.ShowComboWnd(true, nCombo);
                }
            }
        }
        break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_COMBO:
        {
            if (param.attackActor.GetActorType() == ActorType.AT_Player)
            {
                sdGameActor gameActor = (sdGameActor)(param.attackActor);
                sdBaseState baseState = (sdBaseState)gameActor.logicTSM.states[param.data];
                if (baseState != null)
                {
                    baseState.bEnable = (param.data1 == 1);
                }
            }
        }
        break;

        case (int)HeaderProto.EOpreationType.OPREATION_TYPE_ATTACKGETHP:
        {
            AttackRestore data = new AttackRestore();
            data.upperLimit  = op.dwOperationPara1 * 0.0001f;
            data.restoreHp   = (op.dwOperationPara0 == 0);
            data.monsterType = op.dwOperationPara2;
            data.ratio       = param.data * 0.0001f;
            data.actionID    = param.data1;
            sdGameActor gameActor = (sdGameActor)(param.attackActor);
            gameActor.AddAttackRestore(data);
        }
        break;

        case (int)HeaderProto.EOpreationType.OPERATION_TYPE_SUMMON:
        {
            iSummonUniqueID++;
            switch (op.dwOperationPara0)
            {
            case 0:
            case 1:
                PointSummon(actor, param, op);
                break;

            case 2:
            case 3:
                RandomSummon(actor, param, op);
                break;

            case 4:
            case 5:
                RoundSummon(actor, param, op);
                break;
            }
        }
        break;

        case (int)HeaderProto.EOpreationType.OPERATION_TYPE_HIDESHOW:
        {
            HideShowInfo info = new HideShowInfo();
            info.actor     = param.attackActor;
            info.fHideTime = param.data * 0.001f;
            info.fDistance = param.data1 * 0.001f;
            sdHideShowMgr.Instance.AddActor(info);
        }
        break;

        case (int)HeaderProto.EOpreationType.OPERATION_TYPE_FLASH:
        {
            float fFront = 1.0f;
            if ((op.dwOperationPara0 & 1) == 1)
            {
                fFront = -1.0f;
            }
            float fDistance = (float)op.dwOperationPara3 * 0.001f;

            sdActorInterface castActor = param.attackActor;

            int playerLayer  = 1 << LayerMask.NameToLayer("Player");
            int petLayer     = 1 << LayerMask.NameToLayer("Pet");
            int monsterLayer = 1 << LayerMask.NameToLayer("Monster");
            int mask         = ~(playerLayer | petLayer | monsterLayer);

            switch (op.dwOperationPara0)
            {
            case 0:
            case 1:
            {
                fDistance = (float)param.data1 * 0.001f;
                Vector3 dir = castActor.GetDirection() * fFront;
                Vector3 pos = castActor.transform.position;



                int   oldLayer = castActor.gameObject.layer;
                int[] layer    = new int[] {
                    LayerMask.NameToLayer("Monster"),
                    LayerMask.NameToLayer("Pet"),
                    LayerMask.NameToLayer("Player")
                };
                bool[] oldcollision = new bool[3];
                for (int i = 0; i < 3; i++)
                {
                    oldcollision[i] = Physics.GetIgnoreLayerCollision(oldLayer, layer[i]);
                    Physics.IgnoreLayerCollision(oldLayer, layer[i]);
                }

                ((sdGameActor)castActor).moveInternal(dir * fDistance / Time.deltaTime);

                for (int i = 0; i < 3; i++)
                {
                    Physics.IgnoreLayerCollision(oldLayer, layer[i], oldcollision[i]);
                }
                castActor.gameObject.layer = oldLayer;

                Vector3 newPos = castActor.transform.position;

                sdGameLevel.instance.actorMgr.ManualCheckTrigger((sdGameActor)castActor, pos, newPos - pos);

                if (param.data > 0)
                {
                    HideShowInfo info = new HideShowInfo();
                    info.actor     = castActor;
                    info.fHideTime = param.data * 0.001f;
                    info.fDistance = 0.0f;
                    sdHideShowMgr.Instance.AddActorNoRandomPosition(info);
                }
            }
            break;

            case 2:
            case 3:
            {
                float fResearchDistance           = param.data1 * 0.001f;
                int   iAngle                      = op.dwOperationPara1;
                List <sdActorInterface> actorList = null;
                if (iAngle == 360)
                {
                    actorList = sdGameLevel.instance.actorMgr.FindActor(
                        param.attackActor,
                        HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                        param.attackActor.transform.position,
                        Vector3.zero,
                        1,
                        0,
                        fResearchDistance,
                        true);
                }
                else
                {
                    actorList = sdGameLevel.instance.actorMgr.FindActor(
                        param.attackActor,
                        HeaderProto.ESkillObjType.SKILL_OBJ_ENEMY,
                        param.attackActor.transform.position,
                        param.attackActor.GetDirection(),
                        5,
                        iAngle,
                        fResearchDistance,
                        true);
                }

                sdActorInterface targetActor = null;
                if (actorList != null)
                {
                    if (actorList.Count > 0)
                    {
                        if (op.dwOperationPara2 == 0)
                        {
                            targetActor = actorList[0];
                            float min = (castActor.transform.position - targetActor.transform.position).sqrMagnitude;
                            for (int i = 1; i < actorList.Count; i++)
                            {
                                Vector3 v = castActor.transform.position - actorList[i].transform.position;
                                if (v.sqrMagnitude < min)
                                {
                                    min         = v.sqrMagnitude;
                                    targetActor = actorList[i];
                                }
                            }
                        }
                        else
                        {
                            int index = Random.Range(0, actorList.Count);
                            if (index >= actorList.Count)
                            {
                                index = 0;
                            }
                            targetActor = actorList[index];
                        }
                    }
                }

                if (targetActor != null)
                {
                    if (fDistance < targetActor.getRadius() + castActor.getRadius())
                    {
                        fDistance = targetActor.getRadius() + castActor.getRadius();
                    }
                    Vector3    dir = targetActor.GetDirection() * fFront;
                    Vector3    pos = targetActor.transform.position + new Vector3(0, 0.1f, 0);
                    RaycastHit hit;
                    if (Physics.Raycast(pos, dir, out hit, fDistance * 2, mask))
                    {
                        if (hit.distance < fDistance)
                        {
                            fDistance = hit.distance;
                        }
                    }

                    castActor.transform.position = targetActor.transform.position + dir * fDistance;

                    dir.y = 0.0f;
                    dir.Normalize();

                    ((sdGameActor)castActor).spinToTargetDirection(-dir, true);
                    if (param.data > 0)
                    {
                        HideShowInfo info = new HideShowInfo();
                        info.actor     = castActor;
                        info.fHideTime = param.data * 0.001f;
                        info.fDistance = 0.0f;
                        sdHideShowMgr.Instance.AddActorNoRandomPosition(info);
                    }
                }
            } break;
            }
        }
        break;
        }
        return(true);
    }
Esempio n. 19
0
 private void ClientTeleportDestinationSelected(TeleportInfo info)
 {
     ClientTeleportDestinationSelected(info.position);
 }
Esempio n. 20
0
 void Awake()
 {
     info = new TeleportInfo(TeleportID, SceneName, facing);
 }
Esempio n. 21
0
 public virtual void    SetTeleportInfo(TeleportInfo info)
 {
     tpInfo.Add(info);
 }