Arrangé les animations Astronaut (state machines et animations) et activé le spin eject speed

This commit is contained in:
Jean-Sébastien Gervais 2016-04-09 08:30:06 -04:00
parent 5666779d20
commit 5954106bf0
5 changed files with 56 additions and 77 deletions

View File

@ -160,7 +160,8 @@ MonoBehaviour:
aspi: {fileID: 0} aspi: {fileID: 0}
WalkAnimSpeed: 0 WalkAnimSpeed: 0
WalkAnimAngle: 0 WalkAnimAngle: 0
EjectSpinSpeed: 0 EjectSpinSpeed: 80
DustParticlesEmitter: {fileID: 138982, guid: 6233079c5a9a756458811f283fdca112, type: 2}
--- !u!114 &11494368 --- !u!114 &11494368
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@ -74,7 +74,7 @@ ParticleSystem:
minMaxState: 0 minMaxState: 0
speed: 1 speed: 1
randomSeed: 0 randomSeed: 0
looping: 1 looping: 0
prewarm: 0 prewarm: 0
playOnAwake: 1 playOnAwake: 1
moveWithTransform: 1 moveWithTransform: 1

View File

@ -42,14 +42,19 @@ public class Astronaut : MonoBehaviour {
if (oldState == AstronautState.Dashing) if (oldState == AstronautState.Dashing)
{ {
SpriteWalk.gameObject.SetActive(false); _astronautAnimator.Land();
SpriteDash.gameObject.SetActive(true); //SpriteWalk.gameObject.SetActive(false);
//SpriteDash.gameObject.SetActive(true);
} }
else //else if (_state == AstronautState.Jumping)
//{
// _astronautAnimator.Jump();
//}
/*else
{ {
SpriteWalk.gameObject.SetActive(true); SpriteWalk.gameObject.SetActive(true);
SpriteDash.gameObject.SetActive(false); SpriteDash.gameObject.SetActive(false);
} }*/
/*if (_state == AstronautState.Walking) /*if (_state == AstronautState.Walking)
{ {
@ -78,7 +83,7 @@ public class Astronaut : MonoBehaviour {
} }
// Use this for initialization // Use this for initialization
void Start() protected void Start()
{ {
_astronautAnimator = GetComponent<AstronautAnimator>(); _astronautAnimator = GetComponent<AstronautAnimator>();
_astronautAnimator.aspi = this; _astronautAnimator.aspi = this;
@ -242,20 +247,23 @@ public class Astronaut : MonoBehaviour {
{ {
Debug.Log("Jump!"); Debug.Log("Jump!");
if (State >= AstronautState.Ejecting)
return;
_astronautAnimator.Jump();
if (State == AstronautState.Jumping) if (State == AstronautState.Jumping)
{ {
Dash(); Dash();
State=AstronautState.Dashing; //TODO relacher l'état Dashing //State=AstronautState.Dashing; //TODO relacher l'état Dashing
return; return;
} }
else if (State >= AstronautState.Dashing)
return;
else if (State >= AstronautState.Ejecting)
return;
if (!grounded) return; _astronautAnimator.Jump(); // deja dans le property get/set
if (!grounded) return;
vSpeed = JumpSpeed; vSpeed = JumpSpeed;
grounded = false; grounded = false;
State = AstronautState.Jumping; State = AstronautState.Jumping;
@ -270,10 +278,11 @@ public class Astronaut : MonoBehaviour {
if (State >= AstronautState.Ejecting) if (State >= AstronautState.Ejecting)
return; return;
lastDashTime = Time.time; lastDashTime = Time.time;
planet.PushWedge(this.theta); planet.PushWedge(this.theta); //TODO devrait se faire juste avant d'être groundé
State = AstronautState.Dashing;
//State = AstronautState.Dashing; _astronautAnimator.Dash();
//vSpeed = -DashSpeed; //vSpeed = -DashSpeed;
} }
@ -281,6 +290,7 @@ public class Astronaut : MonoBehaviour {
{ {
State = AstronautState.Ejecting; State = AstronautState.Ejecting;
vSpeed = EjectSpeed; vSpeed = EjectSpeed;
_astronautAnimator.Eject();
grounded = false; grounded = false;
} }

View File

@ -9,17 +9,24 @@ public class AstronautAnimator : MonoBehaviour {
public float WalkAnimAngle; public float WalkAnimAngle;
public float EjectSpinSpeed; public float EjectSpinSpeed;
// Use this for initialization public GameObject DustParticlesEmitter;
void Start () { // Use this for initialization
protected void Start () {
} }
// Update is called once per frame // Update is called once per frame
void Update () { protected void Update () {
} }
public void Jump() public void Jump()
{
aspi.SpriteWalk.gameObject.SetActive(true);
aspi.SpriteDash.gameObject.SetActive(false);
}
public void Dash()
{ {
aspi.SpriteWalk.gameObject.SetActive(false); aspi.SpriteWalk.gameObject.SetActive(false);
aspi.SpriteDash.gameObject.SetActive(true); aspi.SpriteDash.gameObject.SetActive(true);
@ -27,6 +34,7 @@ public class AstronautAnimator : MonoBehaviour {
public void Land() public void Land()
{ {
aspi.SpriteWalk.gameObject.SetActive(true); aspi.SpriteWalk.gameObject.SetActive(true);
aspi.SpriteDash.gameObject.SetActive(false); aspi.SpriteDash.gameObject.SetActive(false);
} }
@ -72,4 +80,12 @@ public class AstronautAnimator : MonoBehaviour {
} }
yield return null; yield return null;
} }
public void EmitDustParticules()
{
if (DustParticlesEmitter)
{
var emitter = (GameObject)Instantiate(DustParticlesEmitter, this.gameObject.transform.position, Quaternion.identity);
}
}
} }

View File

@ -85,25 +85,6 @@ NavMeshSettings:
cellSize: 0.16666667 cellSize: 0.16666667
manualCellSize: 0 manualCellSize: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &431637404 stripped
GameObject:
m_PrefabParentObject: {fileID: 170392, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
m_PrefabInternal: {fileID: 1660116367}
--- !u!114 &431637411
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 431637404}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 77462b2431858f84b9bc2d055c2f4d45, type: 3}
m_Name:
m_EditorClassIdentifier:
aspi: {fileID: 0}
WalkAnimSpeed: 0
WalkAnimAngle: 0
EjectSpinSpeed: 0
--- !u!114 &1027139440 stripped --- !u!114 &1027139440 stripped
MonoBehaviour: MonoBehaviour:
m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1, m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1,
@ -157,11 +138,6 @@ Prefab:
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 158e745881137e04ca2086294f44d74c, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 158e745881137e04ca2086294f44d74c, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!212 &1106066633 stripped
SpriteRenderer:
m_PrefabParentObject: {fileID: 21220066, guid: acd71c7b2f995984d9033c9dc4e257dc,
type: 2}
m_PrefabInternal: {fileID: 1660116367}
--- !u!1001 &1223268487 --- !u!1001 &1223268487
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -243,6 +219,10 @@ Prefab:
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 2 value: 2
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11401034, guid: 198e988adacced646a19f757f6237ae1, type: 2}
propertyPath: gaugeMax
value: 100
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: 198e988adacced646a19f757f6237ae1, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 198e988adacced646a19f757f6237ae1, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
@ -293,41 +273,13 @@ Prefab:
propertyPath: m_Name propertyPath: m_Name
value: Astronaut_1 value: Astronaut_1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5402556, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} - target: {fileID: 11491252, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_AngularDrag propertyPath: DustParticlesEmitter
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5402556, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_IsKinematic
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5402556, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_UseGravity
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5402556, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_Mass
value: 1
objectReference: {fileID: 0}
- target: {fileID: 13683032, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_Center.y
value: 1.31
objectReference: {fileID: 0}
- target: {fileID: 13683032, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_Height
value: 1.59
objectReference: {fileID: 0}
- target: {fileID: 13683032, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_Radius
value: 0.76
objectReference: {fileID: 0}
- target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: SpriteWalk
value: value:
objectReference: {fileID: 1106066633} objectReference: {fileID: 138982, guid: 6233079c5a9a756458811f283fdca112, type: 2}
- target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} - target: {fileID: 11491252, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: EjectSpeed propertyPath: EjectSpinSpeed
value: 10 value: -50
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2} m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}