private void SetupCamera() { GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); var player = players.First(p => p.GetComponent <NetworkedBehaviour>().IsLocalPlayer); Debug.Log(player); if (cameraTarget == null) { cameraTarget = GameObject.Find("Main Camera").GetComponent <CameraFollowTarget>(); } cameraTarget.target = player.transform; }
// Update is called once per frame void Update() { if (FollowScript == null) { FollowScript = transform.parent.GetComponent <CameraFollowTarget>(); return; } if (FollowScript.TrackedTarget == null) { return; } HealthText.text = "Hull: " + Mathf.RoundToInt(FollowScript.playersHealth.health) + "/" + Mathf.RoundToInt(FollowScript.playersHealth.MaxHealth); FuelText.text = "Fuel (Litres): " + Mathf.RoundToInt(FollowScript.playersHealth.currentFuel) + "/" + Mathf.RoundToInt(FollowScript.playersHealth.MaxFuel); CargoText.text = "Cargo (Kg): " + Mathf.RoundToInt(FollowScript.playersInventory.currentInventoryWeight) + "/" + Mathf.RoundToInt(FollowScript.playersInventory.MaxInventoryWeight) + "\nCargo ($$$): " + Mathf.RoundToInt(FollowScript.playersInventory.InventoryValue); MoneyText.text = "$" + Mathf.RoundToInt(PlayerBank.instance.TeamMoney); //stats text int a = UpgradesData.instance.DrillUpgrades.Count - 1; int b = UpgradesData.instance.JumpjetUpgrades.Count - 1; int c = UpgradesData.instance.CargoUpgrades.Count - 1; int d = UpgradesData.instance.HealthUpgrades.Count - 1; int e = UpgradesData.instance.FuelUpgrades.Count - 1; StatsText.text = "Upgrades" + "\nDrill " + FollowScript.playersUpgrades.CurrentDrill + "/" + a + "\nBoosters " + FollowScript.playersUpgrades.CurrentJumpJet + "/" + b + "\nCapacity " + FollowScript.playersUpgrades.CurrentCargo + "/" + c + "\nHull " + FollowScript.playersUpgrades.CurrentHealth + "/" + d + "\nFuel " + FollowScript.playersUpgrades.CurrentFuel + "/" + e; //stats text end //consumables ConsumablesText.text = FollowScript.playersInventory.FuelCanisters + "\n" + FollowScript.playersInventory.RepairKits + "\n" + FollowScript.playersInventory.Dynamites + "\n" + FollowScript.playersInventory.TeleportUses + "\n" + FollowScript.playersInventory.TeleportBeacons + "\n" + FollowScript.playersInventory.PocketStations + "\n" + FollowScript.playersInventory.PocketDumps; //consumables end //color Color co = Flasher.color; co.a = Mathf.MoveTowards(co.a, 0f, flashTime * Time.unscaledDeltaTime); Flasher.color = co; AttemptFlash(); oldHealth = FollowScript.playersHealth.health; //colorend //depth CalcDepth(); }
private void FollowTarget(Transform target) { CameraFollowTarget follow = Camera.main.GetComponent <CameraFollowTarget>(); follow.SetTarget(target, false); }
private void Start() { scenarioManager = FindObjectOfType <ScenarioManager>(); cameraFollow = FindObjectOfType <CameraFollowTarget>(); }
private void Start() { m_nonTrackLayerMask = ~LayerMask.GetMask("Surface"); m_cameraFollower = Camera.main.GetComponent <CameraFollowTarget>(); }
void Start() { followTarget = GetComponent <CameraFollowTarget>(); freeMovement = GetComponent <CameraFreeMovement>(); }