Exemple #1
0
        public override void Run()
        {
            Vector3 localScale;

            if (StoryConst.LEFT == dir)
            {
                localScale = new Vector3(-1f, 1f, 1f);
            }
            //右转
            else
            {
                localScale = Vector3.one;
            }

            //主角
            if (StoryConst.SELF_ID == createId)
            {
                AppMap.Instance.me.Controller.transform.localScale = localScale;
            }
            //npc或者monster
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(createId);

                if (action.IsMonster)
                {
                    AppMap.Instance.GetMonster(action.MonsterId).Controller.transform.localScale = localScale;
                }
                else
                {
                    action.Role.transform.localScale = localScale;
                }
            }
        }
Exemple #2
0
        public override void Stop()
        {
            //主角
            if (StoryConst.SELF_ID == createId)
            {
                (AppMap.Instance.me.Controller as ActionControler).StopWalk();
            }
            //npc或者monster
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(createId);

                if (null == action)
                {
                    return;
                }

                if (action.IsMonster)
                {
                    (AppMap.Instance.GetMonster(action.MonsterId).Controller as ActionControler).StopWalk();
                }
                else
                {
                    role = action.Role;
                    StoryRoleMove roleMove = role.GetComponent <StoryRoleMove>();
                    if (null != roleMove)
                    {
                        roleMove.Stop();
                    }
                }
            }
        }
Exemple #3
0
        public override void Run()
        {
            CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(createId);

            if (null != action)
            {
                action.Clear();
            }
        }
Exemple #4
0
        //获得CreateAction对象
        public CreateAction GetCreateAction(string createId)
        {
            foreach (BaseAction action in actionList)
            {
                if (action is CreateAction)
                {
                    CreateAction createAction = action as CreateAction;
                    if (createAction.CreateId == createId)
                    {
                        return(createAction);
                    }
                }
            }

            return(null);
        }
Exemple #5
0
        public override void Run()
        {
            targetPos = new Vector3(targetX, targetY, 0);

            //主角
            if (StoryConst.SELF_ID == createId)
            {
                (AppMap.Instance.me.Controller as ActionControler).MoveSpeed = speed;
                AppMap.Instance.me.Controller.MoveTo(targetX, targetY, null);
            }
            //npc或者monster
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(createId);

                if (null == action)
                {
                    return;
                }

                if (action.IsMonster)
                {
                    (AppMap.Instance.GetMonster(action.MonsterId).Controller as ActionControler).MoveSpeed = speed;
                    AppMap.Instance.GetMonster(action.MonsterId).Controller.MoveTo(targetPos.x, targetPos.y, null);
                }
                else
                {
                    role = action.Role;
                    StoryRoleMove roleMove = role.GetComponent <StoryRoleMove>();

                    if (null != roleMove)
                    {
                        GameObject.Destroy(roleMove);
                    }

                    roleMove           = role.AddComponent <StoryRoleMove>();
                    targetPos.z        = role.transform.position.z;
                    roleMove.TargetPos = targetPos;
                    roleMove.MoveSpeed = speed;
                }
            }
        }
Exemple #6
0
        public override void Run()
        {
            //主角
            if (StoryConst.SELF_ID == createId)
            {
                if ((skill >= Status.ROLL && skill <= Status.SKILL3) || (Status.SKILL4 == skill))
                {
                    AppMap.Instance.me.Controller.SkillController.RequestUseSkill(GetSkillId(skill));
                }
                else
                {
                    AppMap.Instance.me.Controller.StatuController.SetStatu(skill);
                }
            }
            //npc或者monster
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(createId);

                if (action.IsMonster)
                {
                    if (skill >= Status.ATTACK1 && skill <= Status.ATTACK2)
                    {
                        AppMap.Instance.GetMonster(action.MonsterId).Controller.SkillController.RequestUseSkill(GetSkillId(skill));
                    }
                    else
                    {
                        AppMap.Instance.GetMonster(action.MonsterId).Controller.StatuController.SetStatu(skill);
                    }
                }
                else
                {
                    StoryRoleSpell roleSpell = action.Role.AddComponent <StoryRoleSpell>();
                    roleSpell.Repeat = this.repeat;
                    roleSpell.Skill  = this.skill;
                }
            }

            vp_Timer.In(0.5f, Finish, 1, 0);
        }
Exemple #7
0
        public override void Run()
        {
            //主角
            if (StoryConst.SELF_ID == createId)
            {
                ShowMe(visible);
            }
            //npc或者monster
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(createId);

                if (action.IsMonster)
                {
                    AppMap.Instance.GetMonster(action.MonsterId).Controller.gameObject.SetActive(visible);
                }
                else
                {
                    action.Role.SetActive(visible);
                }
            }
        }
Exemple #8
0
        public override void Run()
        {
            //主角
            if (StoryConst.SELF_ID == followId)
            {
                role = AppMap.Instance.me.Controller.gameObject;
            }
            //npc或者monster
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(followId);

                if (null != action)
                {
                    if (action.IsMonster)
                    {
                        role = AppMap.Instance.GetMonster(action.MonsterId).Controller.gameObject;
                    }
                    else
                    {
                        role = action.Role;
                    }
                }
            }

            //是否重置回Hero
            if (reset)
            {
                targetX = AppMap.Instance.me.Controller.transform.position.x;
            }

            DeleteCameraMoveComponent();
            StoryCameraMove cameraMove = Camera.main.gameObject.AddComponent <StoryCameraMove>();

            cameraMove.FollowTarget = role;
            cameraMove.MoveSpeed    = speed;
            cameraMove.TargetPos.x  = targetX;
        }
Exemple #9
0
        public override void Run()
        {
            UILabel labName;
            UILabel labWords;

            //主角显示在左侧
            if (StoryConst.SELF_ID == this.npcId)
            {
                Singleton <StoryView> .Instance.LeftNPC.SetActive(true);

                Singleton <StoryView> .Instance.RightNPC.SetActive(false);

                sprNPC   = Singleton <StoryView> .Instance.LeftNPCSprite;
                labName  = Singleton <StoryView> .Instance.LeftNPCName;
                labWords = Singleton <StoryView> .Instance.LeftNPCWords;
                NPCBustMgr.Instance.GetBust(MeVo.instance.BustUrl, RoleBustLoaded);
            }
            //NPC显示在右侧
            else
            {
                Singleton <StoryView> .Instance.LeftNPC.SetActive(false);

                Singleton <StoryView> .Instance.RightNPC.SetActive(true);

                sprNPC   = Singleton <StoryView> .Instance.RightNPCSprite;
                labName  = Singleton <StoryView> .Instance.RightNPCName;
                labWords = Singleton <StoryView> .Instance.RightNPCWords;
            }

            talkWindow = Singleton <StoryView> .Instance.TalkWindow;

            //显示对话框
            if (!talkWindow.activeSelf)
            {
                talkWindow.SetActive(true);
            }

            //打字机不能重复利用,需要先删除再创建
            TypewriterEffect typewriter = labWords.GetComponent <TypewriterEffect>();

            if (null != typewriter)
            {
                GameObject.Destroy(typewriter);
            }

            //获得头像、主角名字
            string spriteName = "";
            string roleName   = "";

            if (StoryConst.SELF_ID == this.npcId)
            {
                //主角头像
                spriteName = Singleton <RoleMode> .Instance.GetPlayerHeadSpriteName(MeVo.instance.job);

                roleName = MeVo.instance.Name;
            }
            else
            {
                CreateAction action = Singleton <StoryMode> .Instance.GetCreateAction(this.npcId);

                if (null != action)
                {
                    string resourceId = action.ResourceId;

                    //为怪物
                    if (action.IsMonster)
                    {
                        SysMonsterVo vo = BaseDataMgr.instance.getSysMonsterVo(Convert.ToUInt32(resourceId));
                        if (null != vo)
                        {
                            spriteName = vo.icon.ToString();
                            roleName   = vo.name;
                        }
                    }
                    //为NPC
                    else
                    {
                        SysNpcVo vo = BaseDataMgr.instance.GetNpcVoById(Convert.ToUInt32(resourceId));
                        if (null != vo)
                        {
                            spriteName = vo.halfImgSprite;
                            roleName   = vo.name;
                        }
                    }

                    bust = action.Bust;
                }
            }

            sprNPC.atlas = Singleton <AtlasManager> .Instance.GetAtlas(AtlasManager.Header);

            sprNPC.spriteName = spriteName;
            sprNPC.SetActive(false);
            labName.text  = roleName;
            labWords.text = this.words;

            if (null != bust)
            {
                bust.SetActive(true);
                bustVisible = true;
            }

            if (delay > 0f)
            {
                vp_Timer.In(delay, Finish, 1, 0);
            }

            //增加打字效果(测试先屏蔽)
            //typewriter = labWords.gameObject.AddComponent<TypewriterEffect>();
            //typewriter.charsPerSecond = 20;
            //typewriter.DoTypeEnd = Finish;
        }