Ejemplo n.º 1
0
        void Update()
        {
            if (_underConstruction != null)
            {
                Ray pointerRay = Camera.main.ScreenPointToRay(Input.mousePosition);

                Physics.Raycast(pointerRay, out RaycastHit hit, 1000, LayerMask.GetMask("floor"));

                _underConstruction.SetConstructionLocation(hit.point);

                if (hit.collider != null && Input.GetMouseButtonDown(0))
                {
                    _underConstruction.InstID    = _idCount++;
                    _underConstruction.Selected += BuildingSelected;
                    _constructables.Add(_underConstruction);
                    _underConstruction = null;
                    BuildingMenuRef.FillItems(-1, new List <string>()
                    {
                        "barraks", "soldier"
                    });
                }
            }
        }
Ejemplo n.º 2
0
 private void StartPlacingBuilding(Constructable building)
 {
     _underConstruction = building;
 }