Compare commits

..

No commits in common. "364aaced8b8fc0b370810ac12fc838207d496b25" and "62afc25653ca66cb177d5984420265af8b4079c0" have entirely different histories.

5 changed files with 18 additions and 66 deletions

View File

@ -189,7 +189,6 @@ GameObject:
- component: {fileID: 3878447480781341932}
- component: {fileID: 1749848915408613053}
- component: {fileID: 1949941092232239315}
- component: {fileID: 5302021185317648001}
m_Layer: 7
m_Name: Player1
m_TagString: Player
@ -343,16 +342,3 @@ MonoBehaviour:
movement: {x: 0, y: 0}
look: {x: 0, y: 0}
whipAttack: 0
useArrowKeys: 0
--- !u!114 &5302021185317648001
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3120938410244321186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -189,7 +189,6 @@ GameObject:
- component: {fileID: 3878447480781341932}
- component: {fileID: 7071433868121438663}
- component: {fileID: 1949941092232239315}
- component: {fileID: 4751086095402136128}
m_Layer: 7
m_Name: Player2
m_TagString: Player
@ -343,16 +342,3 @@ MonoBehaviour:
movement: {x: 0, y: 0}
look: {x: 0, y: 0}
whipAttack: 0
useArrowKeys: 0
--- !u!114 &4751086095402136128
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3120938410244321186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c66441ada081b6c4c841000e83cc2b7a, type: 3}
m_Name:
m_EditorClassIdentifier:

View File

@ -5,12 +5,30 @@ using UnityEngine;
public class PlayerAnimationHandler : MonoBehaviour
{
Animator animator;
SpriteRenderer sp;
Vector3 prevPos;
void Start()
{
animator = GetComponentInChildren<Animator>();
sp = GetComponentInChildren<SpriteRenderer>();
}
private void Update()
{
if ((transform.position - prevPos).x > 0.1f)
{
sp.flipX = false;
}
else if ((transform.position - prevPos).x < -0.1f)
{
sp.flipX = true;
}
prevPos = transform.position;
}
public void Idle()
{
animator.SetTrigger("Idle");

View File

@ -1,27 +0,0 @@
using UnityEngine;
public class SpriteMovementFlipper : MonoBehaviour
{
SpriteRenderer sp;
Vector3 prevPos;
void Start()
{
sp = GetComponentInChildren<SpriteRenderer>();
}
private void Update()
{
if ((transform.position - prevPos).x > 0.1f)
{
sp.flipX = false;
}
else if ((transform.position - prevPos).x < -0.1f)
{
sp.flipX = true;
}
prevPos = transform.position;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: c66441ada081b6c4c841000e83cc2b7a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: