Exemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     axisController = AxisController.Instance;
     errEngine      = ErrorEngine.Instance;
     thisCollider   = gameObject.GetComponent <Collider>();
     if (gameObject.name == "xAxis")
     {
         currentAxis = CurrentAxis.xAxis;
     }
     else if (gameObject.name == "yAxis")
     {
         currentAxis = CurrentAxis.yAxis;
     }
     else if (gameObject.name == "zAxis")
     {
         currentAxis = CurrentAxis.zAxis;
     }
 }
    private void Update()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (!IsLMB && !IsRMB)
        {
            if (Physics.Raycast(ray, out hit))
            {
                if (hit.transform.gameObject.tag == "Setas")
                {
                    IsVectorMoving = true;
                    currentAxis    = hit.transform.gameObject.GetComponent <AxisControl>().ChangeTo;
                }
                else
                {
                    IsVectorMoving = false;
                    currentAxis    = CurrentAxis.none;
                }
            }
        }
        if (PlayerState == State.SelectConstruct)
        {
            Preview.SetActive(false);
        }
        else
        {
            Preview.SetActive(!LevelEditorPlayerMovement.IsAlt && !IsVectorMoving);
        }
        if (PlayerState != State.SelectConstruct)
        {
            if (Physics.Raycast(ray, out hit))
            {
                gridlock = new Vector3(Mathf.Round(hit.point.x), Mathf.Round(hit.point.y), Mathf.Round(hit.point.z));

                if (hit.transform.gameObject.tag != "LEditor" && hit.transform.gameObject.tag != "GhostEditor")
                {
                    Preview.transform.position = gridlock;
                }
            }
            if (!IsEditing)
            {
                if (LevelEditorPlayerMovement.IsAlt)
                {
                    return;
                }
            }
            Buttons();
            Action();
        }
        else
        {
            switch (PlayerState)
            {
            case State.GroundConstruct:
                break;

            case State.WallsConstruct:
                break;

            case State.Illumination:
                break;

            case State.Painting:
                break;

            case State.ColdZone:
                break;

            case State.HotZone:
                break;
            }
        }
    }