Beispiel #1
0
    public void Place(BuidingProfile building)
    {
        if (_currentPlaced != null)
        {
            return;
        }

        GameObject ghost = Instantiate(building.BuildingView);

        _currentPlaced = new PlacedEntity(ghost.GetComponent <BuildingView>(),
                                          ghost.GetComponent <CollisionTrigger>(),
                                          building);
    }
Beispiel #2
0
    public void Update()
    {
        var inputModule = (CustomStandaloneInputModule)EventSystem.current.currentInputModule;

        if (_currentPlaced != null)
        {
            if (Input.GetMouseButtonDown(0) && _currentPlaced.TryPlace())
            {
                _currentPlaced = null;
            }
            else
            {
                _currentPlaced.MoveView(ProjectOnGrid(inputModule.GetMousePositionOnGameObject()));
            }
        }
    }