Exemplo n.º 1
0
    void Update()
    {
        if (blueprintMode == BlueprintModes.rotating)
        {
            blueprintStructure.transform.Rotate(new Vector3(0, 1, 0), Time.deltaTime * rotationSpeed);
        }

        if (blueprintMode == BlueprintModes.expanding)
        {
            expandTimer += Time.deltaTime;
            if (expandTimer > expandDuration)
            {
                blueprintMode = BlueprintModes.rotating;
            }
            else
            {
                float newScale = expandTimer / expandDuration;
                blueprintStructure.transform.localScale = new Vector3(newScale, newScale, newScale);
            }
        }

        if (blueprintMode == BlueprintModes.rotating || blueprintMode == BlueprintModes.expanding)
        {
            MouseHoverInfo mhi = clickController.GetMouseHoverInfo(blueprintRange);

            if (mhi.IsHit && mhi.hoverObject.layer == LayerMask.NameToLayer("Terrain"))
            {
                blueprintStructure.transform.position = mhi.point;
            }
        }
    }
Exemplo n.º 2
0
 public void StartBlueprint(Thing thing)
 {
     if (blueprintStructure != null)
     {
         Destroy(blueprintStructure);
     }
     blueprintMode      = BlueprintModes.expanding;
     expandTimer        = 0;
     this.thing         = thing;
     blueprintStructure = StructureFactory.MakeStructure(thing.thingType, true);
     blueprintStructure.transform.parent = gameObject.transform;
 }
Exemplo n.º 3
0
    public void DeployHere()
    {
        Debug.Log("DeployHere");
        //the blueprint will stay at this position/rotation and create its BlueprintNodes.
        if (!CanBePlacedHere())
        {
            Debug.LogError("DeployHere happened when not CanBePlacedHere.");
        }

        blueprintMode = BlueprintModes.deployed;
        SetFadedAppearance();
        CreateAllNodes();
    }
Exemplo n.º 4
0
 public void StopBlueprint()
 {
     blueprintMode = BlueprintModes.off;
     Destroy(blueprintStructure);
 }