Пример #1
0
    void ShowPossibleDroplocations()
    {
        SimpleCords origin = originLocation;
        GameObject  GOo    = GameObject.Instantiate(ResourceLibrary.GetPrefabByName("prop_TileHighlightOrigin"));

        GOo.transform.position = origin;
        possiblePositionsGO    = new List <GameObject>();
        possiblePositions      = new List <SimpleCords>();
        possiblePositionsGO.Add(GOo);
        possiblePositions.Add(origin);

        //TODO: change it to whatever we want
        Offset[] miniOffsets = new Offset[]
        {
            new Offset(1, 0),
            new Offset(-1, 0),
            new Offset(0, 1),
            new Offset(0, -1),
        };

        foreach (var item in miniOffsets)
        {
            SimpleCords pos = origin;
            pos = pos.OffsetBy(item);
            Tile currCheck;
            while ((currCheck = space.Map.SaveGet(pos.x, pos.z)).occupation == TileOccupation.Empty)
            {
                GameObject tmp = GameObject.Instantiate(ResourceLibrary.GetPrefabByName("prop_TileHighlightGood"));
                tmp.transform.position = pos;
                possiblePositions.Add(pos);
                possiblePositionsGO.Add(tmp);
                pos = pos.OffsetBy(item);
            }
        }
    }
Пример #2
0
 public void Place(SimpleCords atLocation)
 {
     if (usable)
     {
         GameObject obj = Object.Instantiate(ResourceLibrary.GetPrefabByName(VisualName));
         obj.transform.position = new Vector3(atLocation.x, atLocation.y + 0.5f, atLocation.z);
         GameObject             = obj;
     }
     else
     {
         throw new System.Exception("Used Unusable Material!");
     }
 }
Пример #3
0
    void ShowPossibleBuildings()
    {
        List <DetectedBuilding> possible = BuildingDetector.DetectBuildings(space, blueprints);

        Debug.Log(possible.Count + " Buildings found");
        foreach (var item in possible)
        {
            if (item != null)
            {
                GameObject h = GameObject.Instantiate(ResourceLibrary.GetPrefabByName("prop_Hammer"));
                possibleBuildingHammer.Add(h);
                h.transform.position = item.Location;
                BuildMe script = h.GetComponentInChildren <BuildMe>();
                script.Information = item;
                script.clicker     = () =>
                {
                    BuildBuilding(item);
                };
            }
        }
        ReportDone();
    }
Пример #4
0
    public void PlaceWithOrientation(int rotation, SimpleCords atLocation)
    {
        if (usable)
        {
            Orientatation = rotation;

            for (int i = 0; i < occupying.Length; i++)
            {
                occupying[i] = occupying[i].Rotate(Orientatation);
            }

            GameObject obj = Object.Instantiate(ResourceLibrary.GetPrefabByName(VisualName));
            obj.transform.position = atLocation;
            obj.transform.rotation = Quaternion.Euler(0, 90 * (rotation + 1), 0);
            GameObject             = obj;
            GameObject t = Object.Instantiate(ResourceLibrary.GetPrefabByName("prop_Timer"));
            t.transform.position = atLocation;
            Clock = t.GetComponentInChildren <lookAtCamera>();
            Timer = t;

            Input.InputLocation     = Input.InputLocation.Rotate(Orientatation);
            Output.DeliveryLocation = Output.DeliveryLocation.Rotate(Orientatation);

            if (Input.enabled)
            {
                Clock.SetTimer(-1);
            }
            else
            {
                Clock.SetTimer(Output.DeliverTimer);
            }
            // TODO: Place Object with everything
        }
        else
        {
            throw new System.Exception("Used Unusable Building!");
        }
    }