コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 public Selectable3DObject()
 {
     mouseSelected   = false;
     mouseOver       = false;
     isVisible       = false;
     SelectablelType = SelectableObjectType.None;
 }
コード例 #2
0
    public void SelectBlueprint(int id)
    {
        selectedItem = GameManager.Instance.AllItems.First(x => x.Id == id);
        switch (selectedItem.Type)
        {
        case SelectableObjectType.BuildObject:
            selectedObjectType = SelectableObjectType.BuildObject;
            break;

        case SelectableObjectType.FloorTile:
            selectedObjectType = SelectableObjectType.FloorTile;
            break;

        case SelectableObjectType.Wall:
            selectedObjectType = SelectableObjectType.Wall;
            break;

        default:
            break;
        }
        switch (selectedObjectType)
        {
        case SelectableObjectType.BuildObject:
            gridSizeOptions = GridSizeOptions.buildObjectBased;
            break;

        case SelectableObjectType.FloorTile:
            gridSizeOptions = GridSizeOptions.floorBased;
            break;

        case SelectableObjectType.Wall:
            gridSizeOptions = GridSizeOptions.wallBased;
            break;

        default:
            gridSizeOptions = GridSizeOptions.buildObjectBased;
            break;
        }
        blueprint                 = new Buildable();
        blueprint.Id              = selectedItem.Id;
        blueprint.Name            = selectedItem.Name;
        blueprint.GameObject      = Instantiate(selectedItem.GameObject, new Vector3(0, 0, 0), Quaternion.identity);
        blueprint.GameObject.name = selectedItem.GameObject.name;
        blueprint.GameObject.AddComponent <BuildingController>();
        currentSelectionType = SelectionType.Blueprint;
    }