Add flipping to mobcats
This commit is contained in:
parent
d6cf5a2fb5
commit
343cf5bc3a
@ -447,6 +447,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Anim: {fileID: 5842195514978149329}
|
Anim: {fileID: 5842195514978149329}
|
||||||
|
SpriteRenderer: {fileID: 4848125059538075066}
|
||||||
--- !u!1 &3991584792453052187
|
--- !u!1 &3991584792453052187
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -12,6 +12,7 @@ namespace Saltosion.OneWeapon.Enemies {
|
|||||||
[RequireComponent(typeof(RangedAttackFollowed))]
|
[RequireComponent(typeof(RangedAttackFollowed))]
|
||||||
public class MobCat : MonoBehaviour {
|
public class MobCat : MonoBehaviour {
|
||||||
public Animator Anim;
|
public Animator Anim;
|
||||||
|
public SpriteRenderer SpriteRenderer;
|
||||||
|
|
||||||
private Enemy Enemy;
|
private Enemy Enemy;
|
||||||
private PlayerSighted FollowTrigger;
|
private PlayerSighted FollowTrigger;
|
||||||
@ -47,6 +48,11 @@ namespace Saltosion.OneWeapon.Enemies {
|
|||||||
Anim.Play("Walk");
|
Anim.Play("Walk");
|
||||||
}
|
}
|
||||||
Anim.SetFloat("Speed", Enemy.Movement.SpeedPercentage);
|
Anim.SetFloat("Speed", Enemy.Movement.SpeedPercentage);
|
||||||
|
if (Enemy.Movement.SpeedPercentage > 0.1) {
|
||||||
|
SpriteRenderer.flipX = Vector2.Dot(Enemy.Movement.Direction, Vector2.left) < 0;
|
||||||
|
} else {
|
||||||
|
SpriteRenderer.flipX = Vector2.Dot(FollowBehaviour.TargetDirection, Vector2.left) < 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user