Ejection de l'astronaute sur impact plaque et si atteint le maximum hauteur et toujours au sol..

This commit is contained in:
Jean-Sébastien Gervais 2016-04-09 00:34:00 -04:00
parent c0c7600e33
commit 3a7d1de39f
4 changed files with 42 additions and 51 deletions

View File

@ -36,7 +36,7 @@ ParticleSystem:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 120238}
serializedVersion: 2
lengthInSec: 3
lengthInSec: 0.75
startDelay:
scalar: 0
maxCurve:
@ -83,7 +83,7 @@ ParticleSystem:
serializedVersion: 2
enabled: 1
startLifetime:
scalar: 3
scalar: 0.75
maxCurve:
serializedVersion: 2
m_Curve:
@ -237,7 +237,7 @@ ParticleSystem:
rgba: 4294967295
minMaxState: 0
startSize:
scalar: 1
scalar: 0.5
maxCurve:
serializedVersion: 2
m_Curve:
@ -359,7 +359,7 @@ ParticleSystem:
length: 5
boxX: 1
boxY: 1
boxZ: 35.55
boxZ: 1
arc: 360
placementMode: 0
m_Mesh: {fileID: 0}

View File

@ -61,12 +61,22 @@ public class Astronaut : MonoBehaviour {
private float theta = 0;
private float height = 0;
private float vSpeed = 0;
public float vSpeed = 0;
private bool grounded = false;
private float walkTime = 0;
private int nextStep = 1;
public float GetTheta()
{
return theta;
}
public bool IsGrounded()
{
return grounded;
}
// Use this for initialization
void Start()
{
@ -142,9 +152,10 @@ public class Astronaut : MonoBehaviour {
if (State == AstronautState.Jumping)
State = AstronautState.Idle;
vSpeed = 0f;
if (State < AstronautState.Ejecting) vSpeed = 0f;
}
UpdatePosition();
//float x, y;
@ -224,6 +235,7 @@ public class Astronaut : MonoBehaviour {
//TODO arreter mouvement lateral
State=AstronautState.Idle;
}
}
public void Jump()

View File

@ -33,6 +33,7 @@ public class PlanetManager : MonoBehaviour
var obj = Instantiate(WedgePrefab, new Vector3(0.0f,0.0f, 0.0f), Quaternion.Euler(0, 0, debutAngleTheta));
obj.name = "wedge_" + i;
w.sprite = GameObject.Find(obj.name);
w.gameObject = (GameObject)obj;
wedges.Add(w); //pushes at end.
}
}
@ -99,9 +100,25 @@ public class PlanetManager : MonoBehaviour
var v = wedges[indexOppose];
v.offset = v.offset + CartierStepSize;
if (v.offset > CartierMaxRatio)
if (v.offset >= CartierMaxRatio)
{
v.offset = CartierMaxRatio;
//checker si on éjecte des players
var players = FindObjectsOfType<Astronaut>();
foreach (var p in players)
{
if (v.tMax >= p.GetTheta() && p.GetTheta() >= v.tMin && p.IsGrounded())
{
p.Eject();
}
}
}
v.sprite.transform.localScale = new Vector3(v.offset, v.offset, 1);
// call fill gauge after every hit.
@ -233,6 +250,6 @@ public class PlanetManager : MonoBehaviour
public float tMax = 0;
public GameObject sprite; //sprite et collider 2D
public GameObject gameObject; //wedge prefab avec collider
}
}

View File

@ -104,48 +104,6 @@ MonoBehaviour:
WalkAnimSpeed: 0
WalkAnimAngle: 0
EjectSpinSpeed: 0
--- !u!1001 &595727044
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalPosition.x
value: 8.22
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalPosition.y
value: 1.36
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 494682, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
propertyPath: m_RootOrder
value: 6
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
m_IsPrefabParent: 0
--- !u!114 &1027139440 stripped
MonoBehaviour:
m_PrefabParentObject: {fileID: 11471614, guid: 198e988adacced646a19f757f6237ae1,
@ -367,6 +325,10 @@ Prefab:
propertyPath: SpriteWalk
value:
objectReference: {fileID: 1106066633}
- target: {fileID: 11494368, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: EjectSpeed
value: 50
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
m_IsPrefabParent: 0