Skip to content

Commit

Permalink
instantiating players (battleroller) correctly
Browse files Browse the repository at this point in the history
menu, game scene and player instantiate working!
  • Loading branch information
AitorSimona committed Dec 21, 2020
1 parent ca2d6d8 commit 11ea153
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 60 deletions.
4 changes: 2 additions & 2 deletions BottomGear/Assets/Game/Scenes/GameScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 523789977}
m_LocalRotation: {x: 0.41102695, y: -0, z: -0, w: 0.91162324}
m_LocalPosition: {x: 0, y: 70.7, z: -31.1}
m_LocalPosition: {x: 0, y: 70.7, z: -74.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -627,7 +627,7 @@ Transform:
m_GameObject: {fileID: 1308668355}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: -9.999999, z: 0}
m_LocalScale: {x: 27.889025, y: 27.889025, z: 27.889025}
m_LocalScale: {x: 10.255359, y: 10.255359, z: 10.255359}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
Expand Down
4 changes: 4 additions & 0 deletions BottomGear/Assets/Game/Scenes/Vehicle.unity
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8607155943644011075, guid: 75980be8169e8844595d320b13a7e456, type: 3}
propertyPath: viewIdField
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 75980be8169e8844595d320b13a7e456, type: 3}
--- !u!1 &2113663694
Expand Down
17 changes: 15 additions & 2 deletions BottomGear/Assets/Game/Scripts/Car/WheelDrive.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using UnityEngine;
using System;
using Photon.Pun;

[Serializable]
public enum DriveType
Expand Down Expand Up @@ -32,17 +33,24 @@ public class WheelDrive : MonoBehaviour
[Tooltip("The vehicle's drive type: rear-wheels drive, front-wheels drive or all-wheels drive.")]
public DriveType driveType;

private PhotonView photonView;
//private bool controllable = true;


private Wheel[] m_Wheels;
private Wheel[] m_Wheels;

struct Wheel
{
public WheelCollider collider;
public GameObject mesh;
}

// Find all the WheelColliders down in the hierarchy.
public void Awake()
{
photonView = GetComponent<PhotonView>();
}

// Find all the WheelColliders down in the hierarchy.
void Start()
{
m_Wheels = new Wheel[wheelCount];
Expand Down Expand Up @@ -85,6 +93,11 @@ void Start()
// This helps us to figure our which wheels are front ones and which are rear.
void Update()
{
if (!photonView.IsMine /*|| !controllable*/)
{
return;
}

m_Wheels[0].collider.ConfigureVehicleSubsteps(criticalSpeed, stepsBelow, stepsAbove);

float angle = maxAngle * Input.GetAxis("Horizontal");
Expand Down
2 changes: 1 addition & 1 deletion BottomGear/Assets/Game/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private void StartGame()
Quaternion rotation = Quaternion.Euler(0.0f, angularStart, 0.0f);

PhotonNetwork.Instantiate("BattleRoller", position, rotation, 0); // avoid this call on rejoin (ship was network instantiated before)

//BasicKyle Variant
//if (PhotonNetwork.IsMasterClient)
//{
// StartCoroutine(SpawnAsteroid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ParticleSystem:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 167808}
serializedVersion: 6
serializedVersion: 7
lengthInSec: 2
simulationSpeed: 1
stopAction: 0
Expand Down Expand Up @@ -282,7 +282,7 @@ ParticleSystem:
m_RotationOrder: 0
startSizeY:
serializedVersion: 2
minMaxState: 0
minMaxState: 3
scalar: 1
minScalar: 1
maxCurve:
Expand Down Expand Up @@ -335,7 +335,7 @@ ParticleSystem:
m_RotationOrder: 4
startSizeZ:
serializedVersion: 2
minMaxState: 0
minMaxState: 3
scalar: 1
minScalar: 1
maxCurve:
Expand Down Expand Up @@ -3615,19 +3615,20 @@ ParticleSystem:
range: {x: 0, y: 1}
CollisionModule:
enabled: 0
serializedVersion: 3
serializedVersion: 4
type: 0
collisionMode: 0
colliderForce: 0
multiplyColliderForceByParticleSize: 0
multiplyColliderForceByParticleSpeed: 0
multiplyColliderForceByCollisionAngle: 1
plane0: {fileID: 0}
plane1: {fileID: 0}
plane2: {fileID: 0}
plane3: {fileID: 0}
plane4: {fileID: 0}
plane5: {fileID: 0}
m_Planes:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_Dampen:
serializedVersion: 2
minMaxState: 0
Expand Down Expand Up @@ -3801,17 +3802,20 @@ ParticleSystem:
interiorCollisions: 1
TriggerModule:
enabled: 0
collisionShape0: {fileID: 0}
collisionShape1: {fileID: 0}
collisionShape2: {fileID: 0}
collisionShape3: {fileID: 0}
collisionShape4: {fileID: 0}
collisionShape5: {fileID: 0}
serializedVersion: 2
inside: 1
outside: 0
enter: 0
exit: 0
colliderQueryMode: 0
radiusScale: 1
primitives:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
SubModule:
serializedVersion: 2
enabled: 0
Expand Down Expand Up @@ -5031,7 +5035,7 @@ ParticleSystem:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 185348}
serializedVersion: 6
serializedVersion: 7
lengthInSec: 5
simulationSpeed: 1
stopAction: 0
Expand Down Expand Up @@ -8603,19 +8607,20 @@ ParticleSystem:
range: {x: 0, y: 1}
CollisionModule:
enabled: 0
serializedVersion: 3
serializedVersion: 4
type: 0
collisionMode: 0
colliderForce: 0
multiplyColliderForceByParticleSize: 0
multiplyColliderForceByParticleSpeed: 0
multiplyColliderForceByCollisionAngle: 1
plane0: {fileID: 0}
plane1: {fileID: 0}
plane2: {fileID: 0}
plane3: {fileID: 0}
plane4: {fileID: 0}
plane5: {fileID: 0}
m_Planes:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_Dampen:
serializedVersion: 2
minMaxState: 0
Expand Down Expand Up @@ -8789,17 +8794,20 @@ ParticleSystem:
interiorCollisions: 1
TriggerModule:
enabled: 0
collisionShape0: {fileID: 0}
collisionShape1: {fileID: 0}
collisionShape2: {fileID: 0}
collisionShape3: {fileID: 0}
collisionShape4: {fileID: 0}
collisionShape5: {fileID: 0}
serializedVersion: 2
inside: 1
outside: 0
enter: 0
exit: 0
colliderQueryMode: 0
radiusScale: 1
primitives:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
SubModule:
serializedVersion: 2
enabled: 0
Expand Down
64 changes: 41 additions & 23 deletions BottomGear/Assets/Resources/BattleRoller.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 1864884027688733420}
- component: {fileID: 2878451945818539526}
m_Layer: 0
m_Name: BattleRoller
m_TagString: Untagged
Expand All @@ -1303,28 +1302,6 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2878451945818539526
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1864884027688733411}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3}
m_Name:
m_EditorClassIdentifier:
ObservedComponentsFoldoutOpen: 1
Group: 0
prefixField: -1
observableSearch: 2
Synchronization: 3
OwnershipTransfer: 0
ObservedComponents: []
viewIdField: 0
InstantiationId: 0
isRuntimeInstantiated: 0
--- !u!1 &1864884028113136404
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1418,6 +1395,8 @@ GameObject:
- component: {fileID: 865184823}
- component: {fileID: 865184822}
- component: {fileID: 1817820544}
- component: {fileID: 8607155943644011075}
- component: {fileID: 3545215424946138929}
m_Layer: 0
m_Name: Pivot
m_TagString: Untagged
Expand Down Expand Up @@ -1492,6 +1471,45 @@ MonoBehaviour:
stepsBelow: 7
stepsAbove: 2
driveType: 2
--- !u!114 &8607155943644011075
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3922733138180589459}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: aa584fbee541324448dd18d8409c7a41, type: 3}
m_Name:
m_EditorClassIdentifier:
ObservedComponentsFoldoutOpen: 1
Group: 0
prefixField: -1
observableSearch: 2
Synchronization: 3
OwnershipTransfer: 0
ObservedComponents:
- {fileID: 3545215424946138929}
viewIdField: 0
InstantiationId: 0
isRuntimeInstantiated: 0
--- !u!114 &3545215424946138929
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3922733138180589459}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 64179f3720bbfe947b7724caa67b7c1d, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SynchronizeVelocity: 1
m_SynchronizeAngularVelocity: 1
m_TeleportEnabled: 1
m_TeleportIfDistanceGreaterThan: 3
--- !u!1 &4858638112643814713
GameObject:
m_ObjectHideFlags: 0
Expand Down
4 changes: 2 additions & 2 deletions BottomGear/UserSettings/EditorUserSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ EditorUserSettings:
serializedVersion: 4
m_ConfigSettings:
RecentlyUsedScenePath-0:
value: 224247031146467c0c03096d23205a1e1304571c29202f33212c5326ece92021
value: 224247031146467c0c03096d23205a1e13045707292633032e2c1336acf53a31f6fe
flags: 0
RecentlyUsedScenePath-1:
value: 224247031146467c0c03096d23205a1e1304570d2d2523032e2c1336acf53a31f6fe
flags: 0
RecentlyUsedScenePath-2:
value: 224247031146467c0c03096d23205a1e13045707292633032e2c1336acf53a31f6fe
value: 224247031146467c0c03096d23205a1e1304571c29202f33212c5326ece92021
flags: 0
vcSharedLogLevel:
value: 0d5e400f0650
Expand Down

0 comments on commit 11ea153

Please sign in to comment.