Beispiel #1
0
        public void AddDirection(Vector2 targetDirection)
        {
            if (_base_entity.GetState() != E_StateId.move)
            {
                EntityEventFactory.ChangeInEntityState(_base_entity, E_StateId.move);
            }
            //_reach_target_pos = true;
            DirectionMove move = direction_move as DirectionMove;

            move.move_direction = new Vector3(targetDirection.x, 0, targetDirection.y);
            _move_component     = direction_move;
        }
Beispiel #2
0
        public void MoveToTargetPostion(Vector3 targtetPosition, float speed)
        {
            /*if (_entity.GetState() != E_StateId.move)
             *  EntityEventFactory.ChangeInEntityState(_entity, E_StateId.move);*/

            Vector3       target   = NavMeshHelper.MakeReasonablePos(targtetPosition);
            TargetPosMove pos_move = target_pos_move as TargetPosMove;

            pos_move.target = target;
            pos_move.speed  = speed;
            _move_component = target_pos_move;
        }
Beispiel #3
0
        public void OnUpdate(float dt)
        {
            bool result = false;

            if (_move_component != null)
            {
                result = _move_component.OnMove(this, dt);
            }


            if (result)
            {
                _move_component = null;
            }
        }