Example #1
0
    public static void LeftClick(Vector3 startingMousePosition, Vector3 endingMousePosition, RaycastHit hit)
    {
        //click
        if (startingMousePosition == endingMousePosition)
        {
            switch (hit.transform.gameObject.layer)
            {
            case unitLayer:
                PlayerUnits.DeselectAll();
                PlayerUnits.SingleSelect(hit.collider.gameObject);
                break;

            case movableLayer:
                PlayerUnits.MoveSelected(hit.point);
                break;

            case buildingLayer:
                PlayerBuildings.Select(hit.collider.gameObject);
                break;

            default:
                break;
            }
        }
        //drag
        else
        {
            PlayerUnits.BoxSelect(startingMousePosition);
        }
    }
Example #2
0
 public BuilderManager(DataBuilderPrefab dataBuilderPrefab, Border border, PlayerBuildings playerBuildings,
                       ICheckBeforeBuild checkBeforeBuild, IBuilder builder)
 {
     _dataBuilderPrefab = dataBuilderPrefab;
     _checkBeforeBuild  = checkBeforeBuild;
     _builder           = builder;
     _border            = border;
     _playerBuildings   = playerBuildings;
 }
Example #3
0
 public BuildingBase GetBuilding(int planetId, BuildingType type) => PlayerBuildings.First(b => b.BelongsTo.Id == planetId && b.Type == type);
Example #4
0
 public static void RightClick()
 {
     PlayerUnits.DeselectAll();
     PlayerBuildings.Deselect();
 }