void UpdateAwarenessUI() { if (GameManager.isPaused) { return; } Vector3 npcFwd = npcTransform.forward; npcFwd.y = 0; Vector3 dirToPlayer = GameManager.playerActor.GetPosition() - npcTransform.position; dirToPlayer.y = 0; if (Vector3.Angle(npcFwd, dirToPlayer) < 90) { if (awarenessIcon == null) { awarenessIcon = UIManager.AddDirectionalIcon(awarenessIconPrefab, () => npcTransform.position); awarenessSegment = awarenessIcon.GetComponentInChildren <FilledCircleSegment>(); awarenessSegment.currentFill = 0; } if (awarenessSegment != null) { if (awarenessSegment.currentFill < 1) { awarenessSegment.SetFill(awarenessSegment.currentFill + Time.deltaTime * awarenessSpeedFill); } } } else { if (awarenessIcon != null) { UIManager.RemoveDirectionalIcon(awarenessIcon); awarenessIcon = null; } } }
IEnumerator DemoHitOriginIndicator() { while (true) { yield return(new WaitForSeconds(Random.Range(2, 10))); UIDirectionalIcon hitIcon = UIManager.AddDirectionalIcon(hitIconPrefab, () => hitOriginTransform.position); UIManager.ShowDirtOverlay( // 1, .1f, .25f, 1, RandomRedHue()); if (Random.value < .5f) { UIManager.ShowDirtOverlay( // 1, .1f, .25f, 1, RandomRedHue()); } yield return(new WaitForSeconds(hitIconTime)); UIManager.RemoveDirectionalIcon(hitIcon); } }