fixed asteroid spawn opposite of player

This commit is contained in:
RosimInc 2016-04-08 21:58:50 -04:00
parent 71bb17694f
commit ddf091d610
3 changed files with 27 additions and 13 deletions

View File

@ -57,8 +57,9 @@ GameObject:
- 4: {fileID: 403646}
- 114: {fileID: 11494368}
- 114: {fileID: 11434752}
- 54: {fileID: 5402556}
- 136: {fileID: 13683032}
- 54: {fileID: 5462614}
- 136: {fileID: 13672180}
m_Layer: 0
m_Name: Character
m_TagString: Player
@ -117,7 +118,7 @@ Transform:
- {fileID: 403646}
m_Father: {fileID: 0}
m_RootOrder: 0
--- !u!54 &5402556
--- !u!54 &5462614
Rigidbody:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
@ -130,7 +131,7 @@ Rigidbody:
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_Constraints: 120
m_CollisionDetection: 0
--- !u!114 &11434752
MonoBehaviour:
@ -164,7 +165,21 @@ MonoBehaviour:
JumpSpeed: 5
Gravity: 15
Speed: 5
EjectSpeed: 20
planet: {fileID: 0}
--- !u!136 &13672180
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!136 &13683032
CapsuleCollider:
m_ObjectHideFlags: 1

View File

@ -14,15 +14,13 @@ public class Asteroid : MonoBehaviour
public void Start()
{
speed = Random.Range(1.8F, 3F);
// print(speed);
center = new Vector3(0, 0);
if (RandomRotationSpeed)
rotationSpeed = 10 * UnityEngine.Random.Range(0.25f, 5f);
rotationDirection = (Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f))*2 - 1);
rotationSpeed = 10 * UnityEngine.Random.Range(0.25f, 5f);
rotationDirection = (Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f)) * 2 - 1);
}
// Update is called once per frame

View File

@ -68,10 +68,11 @@ public class AsteroidSpawner : TimerFunctionsClass
var angle = ( 360.0f + (((playerTheta * 180)) / Mathf.PI)) % 360; ///TODO : a changer pour p.theta
print("angle:" + angle);
var AsteroidType = Mathf.RoundToInt(Mathf.Floor(UnityEngine.Random.Range(0f, 3.999f)));
var AsteroidType = Mathf.RoundToInt(Mathf.Floor(UnityEngine.Random.Range(0f, 3.999f)));
float direction = (Mathf.Floor(UnityEngine.Random.Range(0.0f, 1.99f)) * 2 - 1);
Instantiate(AsteroidPrefabTypes[AsteroidType],
planet.GetPlanetCoordinatesFromPlayerXY(angle, UnityEngine.Random.Range(10f,15f)),
direction*planet.GetPlanetCoordinatesFromPlayerXY(angle, UnityEngine.Random.Range(10f,15f)),
Quaternion.identity);
}