학생들 에셋 추가
This commit is contained in:
30
Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs
Normal file
30
Assets/FemaleRunnerAnimset/Scripts/CliffCheck.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CliffCheck : GroundCheck
|
||||
{
|
||||
private Vector3 _initialGroundPos;
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
base.Start();
|
||||
_initialGroundPos = Vector3.zero;
|
||||
}
|
||||
|
||||
protected override void OnTriggerEnter(Collider other)
|
||||
{
|
||||
base.OnTriggerEnter(other);
|
||||
if (other.CompareTag("Ground"))
|
||||
{
|
||||
if(_initialGroundPos == Vector3.zero)
|
||||
{
|
||||
_initialGroundPos = _parent.localPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
_parent.localPosition = _initialGroundPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user