Esempio 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;
            }
        }
    }
Esempio n. 2
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         bool isDriving = occupiedRover != null;
         if (isDriving)
         {
             ExitRover();
         }
         else
         {
             MouseHoverInfo mhi = clickController.GetMouseHoverInfo(reachRange);
             if (mhi.IsHit)
             {
                 Rover newRover = mhi.hoverObject.GetComponent <Rover> ();
                 EnterRover(newRover);
             }
         }
     }
 }