Added project

This commit is contained in:
2023-06-11 00:35:07 +03:00
parent 5bfa765889
commit f06629200c
545 changed files with 44339 additions and 2 deletions

View File

@@ -0,0 +1,39 @@
using UnityEngine;
public class MushroomJumper : MonoBehaviour {
[SerializeField] private Animator _animator;
[SerializeField] private float forceMultiply = 2.0f;
private static readonly int Enter = Animator.StringToHash("Enter");
private PlayerController playerController;
private void OnTriggerEnter2D(Collider2D other) {
if (other.gameObject.CompareTag("Player")) {
_animator.SetTrigger(Enter);
playerController = other.gameObject.GetComponent<PlayerController>();
}
}
private void OnTriggerStay2D(Collider2D other) {
if (other.gameObject.CompareTag("Player")) {
if (playerController == null) {
playerController = other.gameObject.GetComponent<PlayerController>();
}
}
}
private void OnTriggerExit2D(Collider2D other) {
if (other.gameObject.CompareTag("Player")) {
playerController = null;
}
}
public void AddForceJumpPlayer() {
if (playerController != null) {
playerController.Force *= forceMultiply;
playerController.Jump();
playerController.Force /= forceMultiply;
}
}
}