示例#1
0
 public OtherPlayer(float x, float y, ArtificialInput input) : base(x, y)
 {
     artificial = input;
 }
示例#2
0
        void Init()
        {
            //TODO: change it to a loadable property
            ApplicationView.PreferredLaunchViewSize      = new Size(1366, 768);
            ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;

            //Create screen
            screen = new Screen(1366, 768);

            //Create KeyBoard instance
            key = new KeyBoard();

            //Create Mouse instance
            mouse = new Mouse();

            //Init sounds
            Task.Run(async() => await Sound.InitSound());

            if (type != GameType.Client)
            {
                //Create level
                Random random = new Random();
                seed = random.Next(100000000);

                level = new LevelGenerator(seed, 500, true);

                Entity.GenID = true;

                //Create Player
                player = new Player(0, 0, key);

                //Create UI
                ui = new PlayerUI(player);

                //Add Player
                level.AddEntity(player);

                //Init level
                level.Init();

                //Ido meres
                watch.Start();
                lastTime = watch.ElapsedMilliseconds;

                if (type == GameType.Host)
                {
                    artificial = new ArtificialInput();

                    server = new Server("25000");
                    server.StartServer();
                }
            }
            else
            {
                //Ido meres
                watch.Start();
                lastTime = watch.ElapsedMilliseconds;

                artificial = new ArtificialInput();

                Debug.WriteLine(Config.IP);
                client = new Client(Config.IP, "25000");
                client.StartClient();

                Entity.GenID = false;
            }
        }