Пример #1
0
 private void Awake()
 {
     if (_instance == null)
     {
         DontDestroyOnLoad(gameObject);
         _instance = this;
     }
     else if (_instance != this)
     {
         Destroy(gameObject);
     }
 }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of <see cref="GameplayWithStupidAI"/> with specified size of map.
        /// </summary>
        /// <param name="mapSize">Size of the map to play with.</param>
        public GameplayWithStupidAI(Size mapSize) :
            base(mapSize)
        {
            EasyAI stupidAI = new EasyAI(null);

            controller = new GameController(mapSize, new User(), stupidAI)
            {
                Timing     = new HostTimer(10),
                SyncConext = SynchronizationContext.Current
            };
            stupidAI.MyGame = controller.State;
        }
Пример #3
0
        public GameManager()
        {
            var running = true;

            Console.WriteLine("Hello, welcome in Tic Tac Toe. Choose your game mode pleas.");
            while (running)
            {
                Console.WriteLine("Game modes are PvP, EasyAI, NormalAI, UnbeatableAI. For quit write Quit.");
                var input = Console.ReadLine();

                switch (input)
                {
                case "EasyAI":
                    Console.Clear();
                    EasyAI.Start();
                    break;

                case "NormalAI":
                    Console.Clear();
                    NormaAI.Start();
                    break;

                case "UnbeatableAI":
                    Console.Clear();
                    UnbeatableAI.Start();
                    break;

                case "PvP":
                    Console.Clear();
                    PvP.Start();
                    break;

                case "Quit":
                    running = false;
                    break;

                default:
                    Console.WriteLine("Invalid input. This program is case sensitive.");
                    Thread.Sleep(2000);
                    Console.Clear();
                    break;
                }
            }
        }
Пример #4
0
    // Start is called before the first frame update
    void Start()
    {
        bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2(0, 0));
        topRight   = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height));

        AudioManager.AudioSource = AudioSource;
        gameBall             = Instantiate(ball) as Ball;
        gameBall.GameManager = this;
        leftPaddle           = Instantiate(paddle) as Paddle;
        leftPaddle.Init(false, new PlayerControl("PaddleLeft"));
        rightPaddle = Instantiate(paddle) as Paddle;
        IPaddleControls controls = null;

        switch (GameManager.GameType)
        {
        case GameType.MULTIPLAYER:
            controls = new PlayerControl("PaddleRight");
            break;

        case GameType.EASY:
            controls          = new EasyAI(gameBall, rightPaddle);
            rightPaddle.speed = 4;
            break;

        case GameType.MEDIUM:
            controls          = new MediumAI(gameBall, rightPaddle);
            rightPaddle.speed = 5;
            break;

        case GameType.HARD:
            controls          = new HardAI(gameBall, rightPaddle);
            rightPaddle.speed = 7;
            break;
        }
        rightPaddle.Init(true, controls);
        leftPaddle.CanMove  = false;
        rightPaddle.CanMove = false;

        NewGameData();
    }
Пример #5
0
        public void Play()
        {
            IAI p1 = new EasyAI();
            IAI p2 = new EasyAI();

            CriterionType height = new CriterionType()
            {
                Name = ""
            };
            CriterionType weight = new CriterionType()
            {
                Name = ""
            };
            CriterionType kind = new CriterionType()
            {
                Name = ""
            };
            CriterionType color = new CriterionType()
            {
                Name = ""
            };
            CriterionType sexe = new CriterionType()
            {
                Name = ""
            };
            CriterionType dead = new CriterionType()
            {
                Name = ""
            };
            CriterionType hero = new CriterionType()
            {
                Name = ""
            };
            CriterionType vilain = new CriterionType()
            {
                Name = ""
            };
        }
Пример #6
0
 public void SetGameController1Reference(EasyAI controller1)
 {
     gameController1 = controller1;
 }