Compare commits
2 Commits
62afc25653
...
364aaced8b
Author | SHA1 | Date |
---|---|---|
BOT Alex | 364aaced8b | |
BOT Alex | b2da2e48b3 |
|
@ -189,6 +189,7 @@ GameObject:
|
||||||
- component: {fileID: 3878447480781341932}
|
- component: {fileID: 3878447480781341932}
|
||||||
- component: {fileID: 1749848915408613053}
|
- component: {fileID: 1749848915408613053}
|
||||||
- component: {fileID: 1949941092232239315}
|
- component: {fileID: 1949941092232239315}
|
||||||
|
- component: {fileID: 5302021185317648001}
|
||||||
m_Layer: 7
|
m_Layer: 7
|
||||||
m_Name: Player1
|
m_Name: Player1
|
||||||
m_TagString: Player
|
m_TagString: Player
|
||||||
|
@ -342,3 +343,16 @@ MonoBehaviour:
|
||||||
movement: {x: 0, y: 0}
|
movement: {x: 0, y: 0}
|
||||||
look: {x: 0, y: 0}
|
look: {x: 0, y: 0}
|
||||||
whipAttack: 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:
|
||||||
|
|
|
@ -189,6 +189,7 @@ GameObject:
|
||||||
- component: {fileID: 3878447480781341932}
|
- component: {fileID: 3878447480781341932}
|
||||||
- component: {fileID: 7071433868121438663}
|
- component: {fileID: 7071433868121438663}
|
||||||
- component: {fileID: 1949941092232239315}
|
- component: {fileID: 1949941092232239315}
|
||||||
|
- component: {fileID: 4751086095402136128}
|
||||||
m_Layer: 7
|
m_Layer: 7
|
||||||
m_Name: Player2
|
m_Name: Player2
|
||||||
m_TagString: Player
|
m_TagString: Player
|
||||||
|
@ -342,3 +343,16 @@ MonoBehaviour:
|
||||||
movement: {x: 0, y: 0}
|
movement: {x: 0, y: 0}
|
||||||
look: {x: 0, y: 0}
|
look: {x: 0, y: 0}
|
||||||
whipAttack: 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:
|
||||||
|
|
|
@ -5,28 +5,10 @@ using UnityEngine;
|
||||||
public class PlayerAnimationHandler : MonoBehaviour
|
public class PlayerAnimationHandler : MonoBehaviour
|
||||||
{
|
{
|
||||||
Animator animator;
|
Animator animator;
|
||||||
SpriteRenderer sp;
|
|
||||||
|
|
||||||
Vector3 prevPos;
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
animator = GetComponentInChildren<Animator>();
|
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()
|
public void Idle()
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c66441ada081b6c4c841000e83cc2b7a
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue