初始化

This commit is contained in:
2026-06-05 22:12:05 +08:00
commit d7146f87ac
1999 changed files with 221608 additions and 0 deletions

View File

@@ -0,0 +1,122 @@
using System.Collections;
using UnityEngine;
#pragma warning disable CS0649
#if EPO_DOTWEEN
using DG.Tweening;
#endif
namespace EPOOutline.Demo
{
public class BubbleSpot : MonoBehaviour
{
[SerializeField]
private Transform trackPosition;
[SerializeField]
private Vector3 trackShift;
[SerializeField]
private Camera targetCamera;
[SerializeField]
private Transform bubble;
[SerializeField]
private bool visibleFromBegining = false;
[SerializeField]
private float showDelay = 0.0f;
[SerializeField]
private float showDuration = 5.0f;
[SerializeField]
private bool once;
private bool wasShown = false;
private int playersInside = 0;
private IEnumerator Start()
{
Hide(0.0f);
if (!visibleFromBegining)
yield break;
yield return new WaitForSeconds(showDelay);
Show();
yield return new WaitForSeconds(showDuration);
Hide();
}
private void Reset()
{
targetCamera = Camera.main;
}
private void OnTriggerEnter(Collider other)
{
if (!other.GetComponent<Character>())
return;
if (playersInside++ == 0)
Show();
}
private void OnTriggerExit(Collider other)
{
if (!other.GetComponent<Character>())
return;
if (--playersInside == 0)
Hide();
}
private void Show()
{
if (wasShown && once)
return;
wasShown = true;
Show(0.5f);
}
private void Hide()
{
Hide(0.15f);
}
private void Hide(float duration)
{
#if EPO_DOTWEEN
bubble.transform.DOKill(true);
bubble.transform.DOScale(Vector3.zero, duration);
#else
bubble.gameObject.SetActive(false);
#endif
}
private void Show(float duration)
{
#if EPO_DOTWEEN
bubble.transform.DOKill(true);
bubble.transform.DOScale(Vector3.one, duration).SetEase(Ease.OutElastic, 0.00001f);
#else
bubble.gameObject.SetActive(true);
#endif
}
private void Update()
{
if (trackPosition)
transform.position = trackPosition.position + trackShift;
bubble.transform.position = targetCamera.WorldToScreenPoint(transform.position);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 153fa088d36da7048afb9f61d82db346
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/BubbleSpot.cs
uploadId: 710656

View File

@@ -0,0 +1,22 @@
using UnityEngine;
#pragma warning disable CS0649
namespace EPOOutline.Demo
{
public class CameraController : MonoBehaviour
{
[SerializeField]
private Vector3 shift;
[SerializeField]
private float moveSpeed = 2.0f;
[SerializeField]
private Transform target;
private void Update()
{
transform.position = Vector3.Lerp(transform.position, target.position + shift, Time.deltaTime * moveSpeed);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a62326ad06e40944ba38b5f8459852e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/CameraController.cs
uploadId: 710656

View File

@@ -0,0 +1,60 @@
using UnityEngine;
using UnityEngine.AI;
#pragma warning disable CS0649
namespace EPOOutline.Demo
{
public class Character : MonoBehaviour
{
[SerializeField]
private AudioSource walkSource;
[SerializeField]
private NavMeshAgent agent;
[SerializeField]
private Animator characterAnimator;
private float initialWalkVolume = 0.0f;
private Camera mainCamera;
private void Start()
{
initialWalkVolume = walkSource.volume;
mainCamera = Camera.main;
agent.updateRotation = false;
}
private void Update()
{
var forward = mainCamera.transform.forward;
forward.y = 0;
forward.Normalize();
var right = mainCamera.transform.right;
right.y = 0;
right.Normalize();
var direction = forward * Input.GetAxis("Vertical") + right * Input.GetAxis("Horizontal");
if (direction.magnitude > 0.1f)
transform.rotation = Quaternion.RotateTowards(transform.rotation, Quaternion.LookRotation(direction), Time.deltaTime * agent.angularSpeed);
agent.velocity = direction.normalized * agent.speed;
walkSource.volume = initialWalkVolume * (agent.velocity.magnitude / agent.speed);
characterAnimator.SetBool("IsRunning", direction.magnitude > 0.1f);
}
private void OnTriggerEnter(Collider other)
{
var collectable = other.GetComponent<ICollectable>();
if (collectable == null)
return;
collectable.Collect(gameObject);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 88ea7fab53939e247a64a364b62f3f42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/Character.cs
uploadId: 710656

View File

@@ -0,0 +1,123 @@
using System.Collections;
using UnityEngine;
using UnityEngine.AI;
#if EPO_DOTWEEN
using DG.Tweening;
#endif
namespace EPOOutline.Demo
{
public class Chicken : MonoBehaviour
{
[SerializeField]
private bool alwaysActive = false;
[SerializeField]
private bool updateChicken = true;
[SerializeField]
private float searchRadius = 5.0f;
private Outlinable outlinable;
private NavMeshAgent agent;
private Animator animator;
private int enteredCount = 0;
private static int priority = 0;
private void Awake()
{
agent = GetComponent<NavMeshAgent>();
outlinable = GetComponent<Outlinable>();
animator = GetComponent<Animator>();
if (!alwaysActive)
outlinable.enabled = false;
agent.avoidancePriority = priority++;
if (updateChicken)
StartCoroutine(UpdateChicken());
}
private void OnTriggerEnter(Collider other)
{
if (alwaysActive)
return;
if (!other.GetComponent<Character>())
return;
enteredCount++;
outlinable.enabled = true;
}
private void OnTriggerExit(Collider other)
{
if (alwaysActive)
return;
if (!other.GetComponent<Character>())
return;
if (--enteredCount != 0)
return;
outlinable.enabled = false;
}
private IEnumerator UpdateChicken()
{
var path = new NavMeshPath();
while (true)
{
animator.CrossFade("Walk In Place", 0.1f);
var point = Random.insideUnitCircle;
var shift = new Vector3(point.x, 0, point.y) * searchRadius;
NavMeshHit hit;
if (!NavMesh.SamplePosition(transform.position + shift, out hit, searchRadius, -1))
{
yield return null;
continue;
}
Debug.DrawLine(transform.position, hit.position, Color.yellow, 3.0f);
if (!NavMesh.CalculatePath(transform.position, hit.position, -1, path))
{
yield return null;
continue;
}
agent.destination = hit.position;
while (agent.pathStatus != NavMeshPathStatus.PathComplete)
yield return null;
var timeToWait = (agent.remainingDistance / agent.speed) * 1.5f;
while (agent.remainingDistance > agent.stoppingDistance && timeToWait > 0.0f)
{
timeToWait -= Time.deltaTime;
yield return null;
}
animator.CrossFade("Eat", 0.1f);
yield return new WaitForSeconds(Random.Range(1.0f, 5.0f));
yield return null;
}
}
private void OnDrawGizmos()
{
Gizmos.color = new Color(1.0f, 0.0f, 0.0f, 0.2f);
Gizmos.DrawSphere(transform.position, searchRadius);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f8ab645ef8375f84880fc3ed2fe26131
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/Chicken.cs
uploadId: 710656

View File

@@ -0,0 +1,97 @@
using System.Collections;
using UnityEngine;
#pragma warning disable CS0649
#pragma warning disable CS0414
namespace EPOOutline.Demo
{
public class Doughnut : MonoBehaviour, ICollectable
{
[SerializeField]
private float rotationSpeed = 30.0f;
[SerializeField]
private AudioClip eatSound;
[SerializeField]
private float moveAmplitude = 0.25f;
[SerializeField]
private float moveSpeed = 0.2f;
private Outlinable outlinable;
private Vector3 initialPosition;
private float amplitudeShift = 0.0f;
private bool isCollected = false;
private void Start()
{
outlinable = GetComponent<Outlinable>();
amplitudeShift = Random.Range(0.0f, 10.0f);
initialPosition = transform.position;
}
private void Update()
{
if (!isCollected)
transform.position = initialPosition + Vector3.up * Mathf.Sin(Time.time * moveSpeed + amplitudeShift);
transform.Rotate(Vector3.up * rotationSpeed * Time.smoothDeltaTime, Space.World);
}
public void Collect(GameObject collector)
{
if (isCollected)
return;
isCollected = true;
StartCoroutine(AnimateCollection(collector));
}
private IEnumerator AnimateCollection(GameObject collector)
{
AudioSource.PlayClipAtPoint(eatSound, transform.position, 10);
var duration = 0.2f;
var collectionRadius = 1.5f;
var collectionAngle = Random.Range(0.0f, 360.0f);
var timeLeft = duration;
while (collector != null && timeLeft > 0.0f)
{
timeLeft -= Time.smoothDeltaTime;
var collectionShift = Quaternion.Euler(0, collectionAngle, 0) * Vector3.right;
var targetPosition = collector.transform.position + collectionShift + Vector3.up * 4.5f;
transform.position = Vector3.Lerp(transform.position, targetPosition, Time.smoothDeltaTime * 5.0f);
collectionAngle += Time.smoothDeltaTime * 360.0f;
collectionRadius = Mathf.MoveTowards(collectionRadius, 0.0f, Time.smoothDeltaTime * 3.5f);
yield return null;
}
timeLeft = duration;
var initialScale = transform.localScale;
while (timeLeft >= 0.0f)
{
timeLeft -= Time.smoothDeltaTime;
transform.localScale = Vector3.Lerp(initialScale, Vector3.zero, 1.0f - (timeLeft / duration));
yield return null;
}
transform.localScale = Vector3.zero;
Destroy(gameObject);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 012d3fb28f14a104dbd794c44d72dbc9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/Doughnut.cs
uploadId: 710656

View File

@@ -0,0 +1,16 @@
{
"name": "EPODemo",
"rootNamespace": "",
"references": [
"EPO"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 1d41bdd17bdf4c94eb132fc8d677167d
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/EPO Demo.asmdef
uploadId: 710656

View File

@@ -0,0 +1,9 @@
using UnityEngine;
namespace EPOOutline.Demo
{
public interface ICollectable
{
void Collect(GameObject collector);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 41967e269ef105d4e81aa1a28eaffd73
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/ICollectable.cs
uploadId: 710656

View File

@@ -0,0 +1,49 @@
using UnityEngine;
using UnityEngine.EventSystems;
#pragma warning disable CS0649
namespace EPOOutline.Demo
{
public class InteractableObject : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
[SerializeField]
private AudioClip interactionSound;
[SerializeField]
private bool affectOutlinable = true;
private Outlinable outlinable;
private void Start()
{
if (!affectOutlinable)
return;
outlinable = GetComponent<Outlinable>();
outlinable.enabled = false;
outlinable.FrontParameters.FillPass.SetFloat("_PublicAngle", 35.0f);
}
public void OnPointerEnter(PointerEventData eventData)
{
if (!affectOutlinable)
return;
outlinable.enabled = true;
}
public void OnPointerExit(PointerEventData eventData)
{
if (!affectOutlinable)
return;
outlinable.enabled = false;
}
public void OnPointerClick(PointerEventData eventData)
{
AudioSource.PlayClipAtPoint(interactionSound, transform.position, 1.0f);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 5e2be7690b1afa24ab54f137c913fdfe
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/InteractableObject.cs
uploadId: 710656

View File

@@ -0,0 +1,41 @@
using UnityEngine;
namespace EPOOutline.Demo
{
public class UsecaseSwitcher : MonoBehaviour
{
private Transform currentSelected;
private void Start()
{
for (var index = 0; index < transform.childCount; index++)
transform.GetChild(index).gameObject.SetActive(index == 0);
currentSelected = transform.GetChild(0);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.RightArrow))
{
var currentIndex = currentSelected.GetSiblingIndex();
transform.GetChild(currentIndex).gameObject.SetActive(false);
currentIndex++;
currentSelected = transform.GetChild(currentIndex % transform.childCount);
currentSelected.gameObject.SetActive(true);
}
if (Input.GetKeyDown(KeyCode.LeftArrow))
{
var currentIndex = currentSelected.GetSiblingIndex();
transform.GetChild(currentIndex).gameObject.SetActive(false);
currentIndex--;
if (currentIndex < 0)
currentIndex = transform.childCount - 1;
currentSelected = transform.GetChild(currentIndex);
currentSelected.gameObject.SetActive(true);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8c7d530bcfbc51043bddc6d2df566e90
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 157187
packageName: Easy Performant Outline 2D | 3D (URP / HDRP and Built-in Renderer)
packageVersion: 3.5.7
assetPath: Assets/Plugins/Easy performant outline/Demo/Scripts/UsecaseSwitcher.cs
uploadId: 710656