Beispiel #1
0
        private void DeleteCameraMoveComponent()
        {
            StoryCameraMove cameraMove = Camera.main.gameObject.GetComponent <StoryCameraMove>();

            if (null != cameraMove)
            {
                GameObject.Destroy(cameraMove);
            }
        }
Beispiel #2
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;
        }