コード例 #1
0
        public ICommandResult Simulate(ICommandInput commandInput, Unit unit)
        {
            CommandInput_Move input_Move        = commandInput as CommandInput_Move;
            UnitPathComponent unitPathComponent = unit.GetComponent <UnitPathComponent>();

            PathfindingComponent pathfindingComponent = Game.Scene.GetComponent <PathfindingComponent>();

            unitPathComponent.ABPath = ComponentFactory.Create <ABPathWrap, Vector3, Vector3>(unit.Position, input_Move.clickPos);
            pathfindingComponent.Search(unitPathComponent.ABPath);

            CommandResult_Move result_Move = CommandGCHelper.GetCommandResult <CommandResult_Move>();

            result_Move.Path = unitPathComponent.ABPath.Result;
            // result_Move.dir = input_Move.moveDir;// 暂时就以输入的方向作为角色的方向
            return(result_Move);
        }
コード例 #2
0
        public void Awake()
        {
            this.mainCamera = Camera.main;
            this.mapMask    = LayerMask.GetMask("Map");
            commandInput    = new CommandInput_Move();
            Cinemachine.CinemachineCore.GetInputAxis = AxisInputDelegate;

            ReferenceCollector rc = mainCamera.GetComponent <ReferenceCollector>();

            playerCam = rc.Get <GameObject>("PlayerCam").GetComponent <CinemachineVirtualCamera>();
            Unit      = GetParent <Unit>();
            //playerCam.Follow = Unit.GameObject.transform;
            //playerCam.LookAt = Unit.GameObject.GetComponentInChildren<CameraFollowHelper>().unitHead;
            ResetPosition();
            // playerCam.Follow = Unit.GameObject.transform;
            mainCamera.GetComponent <MonoBehaviorEventHelpr>().appFocusEvent = (b) =>
            {
                incontrol = b;
            };
        }