initial commit

This commit is contained in:
2026-05-16 16:12:06 +08:00
parent a7e4ebd4f8
commit f432cfa92f
1008 changed files with 409466 additions and 0 deletions
@@ -0,0 +1,39 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Reflection;
[RequireComponent(typeof(ParticleSystem))]
public class EmitParticlesOnLand : MonoBehaviour
{
public bool emitOnLand = true;
public bool emitOnEnemyDeath = true;
#if UNITY_TEMPLATE_PLATFORMER
ParticleSystem p;
void Start()
{
p = GetComponent<ParticleSystem>();
if (emitOnLand) {
Platformer.Gameplay.PlayerLanded.OnExecute += PlayerLanded_OnExecute;
void PlayerLanded_OnExecute(Platformer.Gameplay.PlayerLanded obj) {
p.Play();
}
}
if (emitOnEnemyDeath) {
Platformer.Gameplay.EnemyDeath.OnExecute += EnemyDeath_OnExecute;
void EnemyDeath_OnExecute(Platformer.Gameplay.EnemyDeath obj) {
p.Play();
}
}
}
#endif
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 05829e42dfc794751bdcf872de6d3239
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,58 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Jiggler : MonoBehaviour
{
[Range(0, 1)]
public float power = .1f;
[Header("Position Jiggler")]
public bool jigPosition = true;
public Vector3 positionJigAmount;
[Range(0, 120)]
public float positionFrequency = 10;
float positionTime;
[Header("Rotation Jiggler")]
public bool jigRotation = true;
public Vector3 rotationJigAmount;
[Range(0, 120)]
public float rotationFrequency = 10;
float rotationTime;
[Header("Scale Jiggler")]
public bool jigScale = true;
public Vector3 scaleJigAmount = new Vector3(.1f, -.1f, .1f);
[Range(0, 120)]
public float scaleFrequency = 10;
float scaleTime;
Vector3 basePosition;
Quaternion baseRotation;
Vector3 baseScale;
void Start(){
basePosition = transform.localPosition;
baseRotation = transform.localRotation;
baseScale = transform.localScale;
}
// Update is called once per frame
void Update()
{
var dt = Time.deltaTime;
positionTime += dt * positionFrequency;
rotationTime += dt * rotationFrequency;
scaleTime += dt * scaleFrequency;
if (jigPosition)
transform.localPosition = basePosition + positionJigAmount * Mathf.Sin(positionTime) * power;
if (jigRotation)
transform.localRotation = baseRotation * Quaternion.Euler(rotationJigAmount * Mathf.Sin(positionTime) * power);
if (jigScale)
transform.localScale = baseScale + scaleJigAmount * Mathf.Sin(scaleTime) * power;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52fec14b1d9c05e479888f44c214042f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,21 @@
using UnityEngine;
using Platformer.Mechanics;
public class PlatformerJumpPad : MonoBehaviour
{
public float verticalVelocity;
void OnTriggerEnter2D(Collider2D other)
{
var rb = other.attachedRigidbody;
if (rb == null) return;
var player = rb.GetComponent<PlayerController>();
if (player == null) return;
AddVelocity(player);
}
void AddVelocity(PlayerController player)
{
player.velocity.y = verticalVelocity;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 839bf2ea498e5ba44ad71860407ba44f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,27 @@
using System.Collections;
using UnityEngine;
using Platformer.Mechanics;
public class PlatformerSpeedPad : MonoBehaviour
{
public float maxSpeed;
[Range (0, 5)]
public float duration = 1f;
void OnTriggerEnter2D(Collider2D other){
var rb = other.attachedRigidbody;
if (rb == null) return;
var player = rb.GetComponent<PlayerController>();
if (player == null) return;
player.StartCoroutine(PlayerModifier(player, duration));
}
IEnumerator PlayerModifier(PlayerController player, float lifetime){
var initialSpeed = player.maxSpeed;
player.maxSpeed = maxSpeed;
yield return new WaitForSeconds(lifetime);
player.maxSpeed = initialSpeed;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5112bc3b826234c41bcf93e09c62c41c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.Events;
public class SimpleTrigger : MonoBehaviour
{
public Rigidbody2D triggerBody;
public UnityEvent onTriggerEnter;
void OnTriggerEnter2D(Collider2D other){
//do not trigger if there's no trigger target object
if (triggerBody == null) return;
//only trigger if the triggerBody matches
var hitRb = other.attachedRigidbody;
if (hitRb == triggerBody){
onTriggerEnter.Invoke();
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4e0430a9dc6ae0b4a81c4cb4674809a9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: