Esempio n. 1
0
        public static void PlaceAStructure(Texture2D texture)
        {
            adjustedCoordinates = new Vector2(Engine.Engine.MouseCoordinates.X, Engine.Engine.MouseCoordinates.Y);

            Engine.Engine.Blueprint = new Rectangle((int)adjustedCoordinates.X - (texture.Width / 2),
                                                    (int)adjustedCoordinates.Y - (texture.Width / 2), texture.Width, texture.Height);

            if (CheckMouseStateChange.IsMouseClicked() && CheckIfGroundClear(Engine.Engine.Blueprint))
            {
                switch (SelectedStructure)
                {
                case BuildingSelected.SmallTent:
                    Tent.CreateSmallTent(adjustedCoordinates, Engine.Engine.Blueprint);
                    break;

                case BuildingSelected.LargeTent:
                    Tent.CreateLargeTent(adjustedCoordinates, Engine.Engine.Blueprint);
                    break;
                }

                IsPlacingBuilding = false;
                BuildMenuInteraction.IsBuildMenuOpen = false;
                SelectedStructure = BuildingSelected.None;
            }
        }
Esempio n. 2
0
        public void Open()
        {
            Dispose();

            buildingsLayout.Render();
            buildingsLayout.Clicked
            .Subscribe(building => BuildingSelected?.Invoke(building))
            .AddTo(disposables);

            buildingsLayout.gameObject.SetActive(true);
        }