Example #1
0
        public AutoPlayer CreateAutoPlayer(Scene _this, int RobotId, Vector2 pos, Vector2 dir)
        {
            var autoPlayer = new AutoPlayer();

            autoPlayer.InitByRobot(_this.GenerateNextId(), RobotId);

            if (!_this.ValidPosition(pos))
            {
                Logger.Error("Npc postion is invalid. RobotId={2},name={0}, pos={1}", autoPlayer.GetName(), pos, RobotId);
            }

            autoPlayer.SetPosition(pos.X, pos.Y);
            autoPlayer.SetDirection(dir);

            _this.EnterScene(autoPlayer);
            return(autoPlayer);
        }
Example #2
0
        public AutoPlayer CreateAutoPlayer(Scene _this,
                                           LogicSimpleData logic,
                                           SceneSimpleData scene,
                                           Vector2 pos,
                                           Vector2 dir)
        {
            var autoPlayer = new AutoPlayer();

            autoPlayer.Init(_this.GenerateNextId(), logic, scene);

            if (!_this.ValidPosition(pos))
            {
                Logger.Error("CreateAutoPlayer postion is invalid. PlayerId={2},name={0}, pos={1}", autoPlayer.GetName(),
                             pos, logic.Id);
            }

            autoPlayer.SetPosition(pos.X, pos.Y);
            autoPlayer.SetDirection(dir);

            _this.EnterScene(autoPlayer);
            return(autoPlayer);
        }