public void ClickMouse(Transform _target, Transform _camera, Collider[] _playerCol) { // deactivate cube if exists if (cube != null) { cube.Toggle(); return; } if (_target != null) { GameObject cubeObject = GameObject.Instantiate(cubePrefab, _target.transform.position, Quaternion.Euler(0f, 0f, 0f)) as GameObject; cube = cubeObject.GetComponent <CubeController>(); knifeController.ReturnKnife(); cube.Setup(_camera, _playerCol, _target); } else { GameObject cubeObject = GameObject.Instantiate(cubePrefab, _camera.position + _camera.forward, Quaternion.Euler(0f, 0f, 0f)) as GameObject; cube = cubeObject.GetComponent <CubeController>(); cube.Setup(_camera, _playerCol, _target); } }
public virtual void ChangeInto(List <GameObject> Cubes) { SetParts(); int i = 0; CubesLoc = Cubes; int MovinPartIterator = 0; for (i = 0; i < Construct.StaticSlots(Level).Length; i++) { CubeController NewStatic = new CubeController(); NewStatic.Cube = CubesLoc[i]; NewStatic.Setup(); NewStatic.Destination = Construct.Configurations[Level].StaticParts[i]; MovingCubes.Add(NewStatic); } for (; i < Construct.ConstructCubeRequirement(Level);) { if (Obj_MovingParts[MovinPartIterator].Part != null) { for (int j = 0; j < Obj_MovingParts[MovinPartIterator].Part.CubeLoc.Length && i < Construct.ConstructCubeRequirement(Level); j++, i++) { CubeController NewMoving = new CubeController(); NewMoving.Cube = CubesLoc[i]; // Debug.Log("Line 57 : " + Obj_MovingParts[MovinPartIterator].getContainer.transform.parent.gameObject.name); CubesLoc[i].transform.parent = Obj_MovingParts[MovinPartIterator].getContainer.transform; CubesLoc[i].transform.localScale = Vector3.one; NewMoving.Destination = Obj_MovingParts[MovinPartIterator].Part.NextPosition(j); NewMoving.Setup(); MovingCubes.Add(NewMoving); } } MovinPartIterator++; } ReConfigure(); }