Ejemplo n.º 1
0
 private void BuildWallsInput()
 {
     if (Input.GetKeyDown(KeyCode.Mouse0) && Input.GetKey(KeyCode.LeftShift))
     {
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         var hit = new RaycastHit();
         if (Physics.Raycast(ray, out hit))
         {
             var wwObject = hit.transform.gameObject.GetComponent <WWObject>();
             if (wwObject != null)
             {
                 if (!wwObject.Equals(curObject))
                 {
                     BuilderAlgorithms.BuildPerimeterWalls(GetResourceTag(), wwObject);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        private WWObject PlaceObject(Vector3 position)
        {
            List <int> possibleConfigurations =
                BuilderAlgorithms.GetPossibleRotations(position, GetResourceTag());

            if (possibleConfigurations.Count == 0)
            {
                return(null);
            }
            int theRot = possibleConfigurations[0];

            if (possibleConfigurations.Contains(curRotation))
            {
                theRot = curRotation;
            }
            Coordinate   coordRotated = CoordinateHelper.UnityCoordToWWCoord(position);
            var          wwTransform  = new WWTransform(coordRotated, theRot);
            WWObjectData objData      = WWObjectFactory.CreateNew(wwTransform, GetResourceTag());
            WWObject     go           = WWObjectFactory.Instantiate(objData);

            return(go);
        }