void EnterTierSpace() { //Leaves the player ship obj on for use in tier space DeactivateSubSpaceElements(false); SetTierSpaceElements(); currentTier = InteractionTier.TierTransition; }
void EnterHigherTierSpace() { tierCounter++; activeTier = activeTier.parentEntity; if (tierCounter == (int)InteractionTier.System) { } currentTier = InteractionTier.TierTransition; }
void SubSpace() { if (Input.GetKeyDown(KeyCode.F)) { } if (Input.GetKey(KeyCode.E)) { Camera.main.transform.RotateAround(playerShipObj.transform.position, Vector3.up, -50f * Time.deltaTime); } if (Input.GetKey(KeyCode.Q)) { Camera.main.transform.RotateAround(playerShipObj.transform.position, Vector3.up, 50f * Time.deltaTime); } MoveShipAndCamera(); ZoomControl(); if (Input.GetMouseButton(0)) { } if (Input.GetMouseButtonDown(1)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { if (hit.collider.name == "Constructor_SubSpace") { currentShipConstructorObj.SetActive(true); ShipCell[] shipCells = currentShipConstructorObj.GetComponentsInChildren <ShipCell> (true); for (int i = 0; i < shipCells.Length; i++) { shipCells[i].gameObject.SetActive(true); } ShipConstructionCanvas.SetActive(true); DeactivateSubSpaceElements(false); currentTier = InteractionTier.ShipConstruction; } else if (hit.collider.gameObject == SubSpace_ColliderPlane) { currentSubSpaceDestination = new Vector3(hit.point.x, playerShipObj.transform.position.y, hit.point.z); //Ship must smoothly travel to this point //It would be easy enough to make the ship go straight to the point //Making it flow there increases visual appeal, but is extra work? //May not be so hard if slerp does what I think it does } } } if (currentSubSpaceDestination != playerShipObj.transform.position) { playerShipObj.transform.Translate(Vector3.forward * Time.deltaTime * shipSpeed); //Quaternion turnAngle = Quaternion.FromToRotation() //playerShipObj.transform.rotation = Quaternion.Lerp } }
void Start() { #region State Initialization currentInteractionTier.Add(InteractionTier.ShipConstruction, new Action(ShipConstruction)); currentInteractionTier.Add(InteractionTier.SubSpace, new Action(SubSpace)); currentInteractionTier.Add(InteractionTier.TierTransition, new Action(TierTransition)); currentInteractionTier.Add(InteractionTier.TierHandler, new Action(TierHandler)); currentTier = InteractionTier.ShipConstruction; #endregion }
void TierTransition() { if (tierCounter == (int)InteractionTier.Planet) { HandlePlanetActiveTier(); } else if (tierCounter == (int)InteractionTier.System) { HandleSystemActiveTier(); } currentTier = InteractionTier.TierHandler; }
void ShipConstruction() { //Ship constructor turns itself off... the game controller will transition once //this happens if (currentShipConstructorObj.gameObject.activeInHierarchy == false) { playerShipObj = GameObject.Find("PlayerShipObj"); if (playerShip == null) { playerShip = GameObject.Find("PlayerShip"); } playerShip.SetActive(true); playerShipComponent = playerShip.GetComponent <Ship>(); shipSpeed = playerShipComponent.GetShipSpeed(); constructionCameraPos = Camera.main.transform.position; constructionCameraRot = Camera.main.transform.rotation; ActivateSubSpaceElements(); ShipConstructionCanvas.SetActive(false); currentTier = InteractionTier.SubSpace; } }
/* * public TierEntity (int _number, InteractionTier _tier, int _radius, TierEntity _parentEntity){ * number = _number; * entityTier = _tier; * entityRadius = _radius; * parentEntity = _parentEntity; * }*/ public TierEntity(int _number, InteractionTier _tier, int _radius, TierEntity _parentEntity) { number = _number; entityTier = _tier; entityRadius = _radius; parentEntity = _parentEntity; //Stops recursion if at local tier if (entityTier != InteractionTier.Planet) { //Number of sub entities int randomRange = UnityEngine.Random.Range(randomMin, randomMax + 1); //Generates sub entities for (int a = 0; a < randomRange; a++) { int randomRadius = UnityEngine.Random.Range(radiusMin, radiusMax + 1); TierEntity newEntity = new TierEntity(a, entityTier - 1, randomRadius, this); childEntities.Add(a, newEntity); } } }
void EnterLowerTierSpace() { tierCounter--; currentTier = InteractionTier.TierTransition; }
public TierEntity(int _number, InteractionTier _tier, TierEntity _parentEntity) { number = _number; entityTier = _tier; parentEntity = _parentEntity; }