private void Update() { //pause if (pause) { GameObject.Find("Pause").GetComponent <Pause>().TogglePause(); } if (Pause.paused) { pause = false; } if (photonView.IsMine) { //Controls pause = Input.GetKeyDown(KeyCode.Escape); if (damageDisplayWait > 0) { damageDisplayWait -= Time.deltaTime; } else if (damageDisplayImage.color.a > 0) { damageDisplayImage.color = Color.Lerp(damageDisplayImage.color, new Color(255, 0, 0, 0), Time.deltaTime * 3); //Lerp = Uebergang } loadout.RefreshAmmo(ui_Ammo); if (loadout.isAiming && crosshair.activeSelf) { crosshair.SetActive(false); } else if (!loadout.isAiming && !crosshair.activeSelf) { crosshair.SetActive(true); } } }
void Start() { damageDisplayImage = GameObject.Find("HUD/DamageDisplay/Image").GetComponent <Image>(); crosshair = GameObject.Find("HUD/Crosshair"); crosshair.SetActive(true); manager = GameObject.Find("Manager").GetComponent <Manager>(); loadout = GetComponent <Loadout>(); currHealth = maxHealth; if (photonView.IsMine) { damageDisplayImage.color = new Color(255, 0, 0, 0);//versichert, dass das DamageDisplayt standardgemaess unsichtbar ist ui_healthBar = GameObject.Find("HUD/Health/Bar").transform; ui_Username = GameObject.Find("HUD/Profile/Username/Text").GetComponent <Text>(); ui_Ammo = GameObject.Find("HUD/Ammo/Text").GetComponent <Text>(); photonView.RPC("SyncProfile", RpcTarget.All, MainMenu.myProfile.username, MainMenu.myProfile.level, MainMenu.myProfile.xp, MainMenu.myProfile.currency); //UI Refreshes RefreshHealthBar(); loadout.RefreshAmmo(ui_Ammo); ui_Username.text = MainMenu.myProfile.username; } }