示例#1
0
    private void PlaceSpawner()
    {
        Road road = IsTargetingRoadEnd();

        if (road)
        {
            if (Input.GetMouseButtonDown(0))
            {
                GameObject spawner = Instantiate(_SpawnerBP);
                if (!road.ConnectSpawner(spawner, road.GetClickedRoadEnd(Camera.main.ScreenToWorldPoint(_CurrentMousePos))))
                {
                    Destroy(spawner);
                }
            }
            if (Input.GetMouseButtonDown(1))
            {
                road.RemoveSpawner(road.GetClickedRoadEnd(Camera.main.ScreenToWorldPoint(_CurrentMousePos)));
            }
        }
    }