void Start() { entityMovement = this.GetComponent <Movement>(); playerScript = this.GetComponent <Player>(); entityCore = this.GetComponent <EntitySystem_Core>(); playerRigidbody = this.GetComponent <Rigidbody>(); playerVisibleBody = entityCore.visibleBody.transform; playerVisibleBody.SetParent(null); cameraPivotPoint.SetParent(null); active_gravityForce = base_gravityForce; active_dashPower = base_dashPower; Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; }
private void InfoScan() { Ray targetRay = playerCamera.ViewportPointToRay(new Vector3(.5f, .5f, 15)); Transform target = Utilities.InfoScanFromViewport(targetRay, 1, 10000, entityScanMask, tagsToScan); // Debug.Log("Target acquired: " + target); if (target != null) { EntitySystem_Core targetCore = target.GetComponent <EntitySystem_Core>(); if (targetCore == null) { GameSystem_UIManager.Instance.window_entityTarget.SetActive(false); GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Neutral); } else { if (GameSystem.GameSystem_Core.Instance.pvpEnabled == true) //If so, we don't run any blocks. What's acting on us isn't ours and anything can act on us. { if (target.CompareTag("Sentry") || target.CompareTag("Proxy") || target.CompareTag("Player")) { if (entityCore.CheckOwnership(targetCore) == true) { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Friendly); } else { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Hostile); } } else if (target.CompareTag("Machine")) { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Hostile); } else { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Neutral); } } else { if (target.CompareTag("Sentry") || target.CompareTag("Proxy") || target.CompareTag("Player")) { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Friendly); } else if (target.CompareTag("Machine")) { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Hostile); } else { GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Neutral); } } //End Crosshair update //Begin updating HUD GameSystem_UIManager.Instance.window_entityTarget.SetActive(true); GameSystem_UIManager.Instance.text_entityName.text = "Lv: " + targetCore.entityInfo.active_entityLevel + " " + targetCore.entityInfo.entityName; GameSystem_UIManager.Instance.text_entityHealth.text = targetCore.active_entityVitality + " / " + targetCore.active_entityMaxVitality; GameSystem_UIManager.Instance.image_entityHealthBar.fillAmount = targetCore.active_entityVitality / targetCore.active_entityMaxVitality; GameSystem_UIManager.Instance.image_entityPicture.sprite = targetCore.entityInfo.entityImage; } } else { GameSystem_UIManager.Instance.window_entityTarget.SetActive(false); GameSystem_UIManager.Instance.UpdateCrosshair(GameSystem_UIManager.ScanType.Neutral); } }