Exemplo n.º 1
0
        public static FieldStateNormal GetInstance()
        {
            if (FieldStateNormal.Instance == null)
            {
                FieldStateNormal.Instance = new FieldStateNormal();
            }

            return(FieldStateNormal.Instance);
        }
Exemplo n.º 2
0
        public Field(int x, int y)
        {
            this.NextInChain = NullField.GetInstance();
            this.Hero        = null;
            this.State       = FieldStateNormal.GetInstance();

            this.x = x;
            this.y = y;

            this.Observers = new List <Observer>();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Field[][] Fields = new Field[5][];
            for (int i = 0; i < Fields.Length; i++)
            {
                Fields[i] = new Field[5];
                for (int j = 0; j < Fields[i].Length; j++)
                {
                    Fields[i][j] = new Field(i, j);
                }
            }

            Fields[0][1].SetStateNew(FieldStateForest.GetInstance());
            Fields[0][3].SetStateNew(FieldStateImpassable.GetInstance());

            Fields[2][2].SetStateNew(FieldStateImpassable.GetInstance());
            Fields[2][3].SetStateNew(FieldStateImpassable.GetInstance());
            Fields[3][2].SetStateNew(FieldStateImpassable.GetInstance());
            Fields[3][3].SetStateNew(FieldStateImpassable.GetInstance());

            Fields[1][3].SetStateNew(FieldStateNormal.GetInstance());
            Fields[1][4].SetStateNew(FieldStateNormal.GetInstance());

            Battlefield           bf = new Battlefield(Fields.Select(x => x.ToList()).ToList());
            BattleController      bc = new BattleController(bf);
            MarketplaceController mc = new MarketplaceController();
            Menu menu = new Menu();

            PrepareHeroes(bf);

            ControllerMediator mediator = new ControllerMediator(bc, mc, menu);

            mediator.SwitchMode(Controller.ControllerType.Menu);


            /*bc.ReceiveCommands();
             * Console.ReadLine();
             */
            System.Environment.Exit(0);
        }
 protected override void UpdateFieldStateAfterGathering(Field Field)
 {
     Field.SetStateNew(FieldStateNormal.GetInstance());
 }
Exemplo n.º 5
0
 public FieldMemento()
 {
     this.State    = FieldStateNormal.GetInstance();
     this.Resource = null;
 }