Ajout rigid body à l'astronaute pour Stun si collision avec Asteroid

This commit is contained in:
Jean-Sébastien Gervais 2016-04-08 20:16:59 -04:00
parent a20f6027dd
commit 2344057072
4 changed files with 94 additions and 13 deletions

View File

@ -57,9 +57,11 @@ GameObject:
- 4: {fileID: 403646}
- 114: {fileID: 11494368}
- 114: {fileID: 11434752}
- 54: {fileID: 5402556}
- 136: {fileID: 13683032}
m_Layer: 0
m_Name: Character
m_TagString: Untagged
m_TagString: Player
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
@ -71,7 +73,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 170392}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 4.18, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_Children:
- {fileID: 418246}
@ -85,7 +87,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 157058}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.14, y: 0.27, z: 0}
m_LocalPosition: {x: -0.04, y: 0.63, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 403646}
@ -97,7 +99,7 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 130732}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: -0.18, y: 0.36, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 403646}
@ -109,12 +111,27 @@ Transform:
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 154602}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0.11}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 403646}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!54 &5402556
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 170392}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &11434752
MonoBehaviour:
m_ObjectHideFlags: 1
@ -141,8 +158,26 @@ MonoBehaviour:
Rotator: {fileID: 154602}
SpriteWalk: {fileID: 130732}
SpriteDash: {fileID: 157058}
StepTime: 0
JumpSpeed: 0
Width: 0.4
DashTime: 0.4
StepTime: 5
JumpSpeed: 5
Gravity: 15
Speed: 5
planet: {fileID: 0}
--- !u!136 &13683032
CapsuleCollider:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 170392}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.77
m_Height: 3.37
m_Direction: 1
m_Center: {x: -0.03, y: 0.35, z: 0}
--- !u!212 &21220066
SpriteRenderer:
m_ObjectHideFlags: 1
@ -168,7 +203,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 15
m_Sprite: {fileID: 21300000, guid: 028cce0260747214d81db557ec6f37c4, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
@ -198,7 +233,7 @@ SpriteRenderer:
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
m_SortingOrder: 15
m_Sprite: {fileID: 21300000, guid: 877352de2811c3e46b8b58e2475e07b3, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0

View File

@ -34,7 +34,8 @@ public class Asteroid : MonoBehaviour
if (otherCol.gameObject.tag == "Player")
{
//Stun the player
///Stun the player
otherCol.gameObject.GetComponent<Astronaut>().Stun();
}
if (otherCol.gameObject.tag == "Wedge")
{

View File

@ -234,7 +234,17 @@ public class Astronaut : MonoBehaviour {
planet.PushWedge(this.theta);
}
public void OnGUI()
/// <summary>
/// A character is stunned when hit by asteroid.
/// </summary>
public void Stun()
{
print("Stunned");
}
public void OnGUI()
{
if (GUI.Button(new Rect(10, 10, 150, 50), State.ToString()))
Debug.Log("Clicked the button with an image");

View File

@ -85,6 +85,38 @@ NavMeshSettings:
cellSize: 0.16666667
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &448376563 stripped
GameObject:
m_PrefabParentObject: {fileID: 170392, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
m_PrefabInternal: {fileID: 1660116367}
--- !u!136 &448376564
CapsuleCollider:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 448376563}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.77
m_Height: 3.37
m_Direction: 1
m_Center: {x: -0.03, y: 0.35, z: 0}
--- !u!54 &448376565
Rigidbody:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 448376563}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!1 &563857051
GameObject:
m_ObjectHideFlags: 0
@ -239,7 +271,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
textTime:
NextSpawnTime: 0.33
AsteroidPrefab: {fileID: 160026, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
AsteroidPrefab1: {fileID: 160026, guid: cc1a204562630cd40a1dd685b5ed8e6e, type: 2}
AsteroidPrefab2: {fileID: 160026, guid: 9e24cfebf8317af4090edf41a498cde3, type: 2}
AsteroidPrefab3: {fileID: 160026, guid: 2d040b7dcfc7d564e98f7405c6746934, type: 2}
AsteroidPrefab4: {fileID: 160026, guid: 834d089adee1456459b32802ed8f11fb, type: 2}
GenerationVersLesjoueurs: 1
--- !u!4 &1055650859
Transform:
@ -317,7 +352,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 494126, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_LocalPosition.z
value: 0
value: 0.11
objectReference: {fileID: 0}
- target: {fileID: 494126, guid: acd71c7b2f995984d9033c9dc4e257dc, type: 2}
propertyPath: m_LocalRotation.x