Browse Source

Made players spawn in correct direction

Josh_Dev_branch
JoshuaReason 5 years ago
parent
commit
a566463e20
12 changed files with 112 additions and 5 deletions
  1. +1
    -1
      Assets/Models.meta
  2. +8
    -0
      Assets/Plugins.meta
  3. +8
    -0
      Assets/Plugins/IngameDebugConsole.meta
  4. +8
    -0
      Assets/Plugins/IngameDebugConsole/Android.meta
  5. +8
    -0
      Assets/Plugins/IngameDebugConsole/Prefabs.meta
  6. +8
    -0
      Assets/Plugins/IngameDebugConsole/Scripts.meta
  7. +8
    -0
      Assets/Plugins/IngameDebugConsole/Sprites.meta
  8. +8
    -0
      Assets/Plugins/IngameDebugConsole/Sprites/Unused.meta
  9. +16
    -1
      Assets/Scenes/Server Scenes/ServerTestScene.unity
  10. +29
    -2
      Assets/Scripts/Block.cs
  11. +8
    -0
      Assets/Scripts/LogicBlocks.meta
  12. +2
    -1
      Assets/Scripts/Managers/GameManager.cs

Assets/Scripts/Components.meta → Assets/Models.meta View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8d7394d70ec233849a60a26da5f23b75
guid: 296bd90e667df1f4697823a0aa45acf0
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

+ 8
- 0
Assets/Plugins.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eb6762a6d45772b43a77849ba46f89db
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Plugins/IngameDebugConsole.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f8eae876be4b03438375a82d2c69b4d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Plugins/IngameDebugConsole/Android.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3d7d7a61a5341904eb3c65af025b1d86
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Plugins/IngameDebugConsole/Prefabs.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7dbc36665bc0d684db9a4447e27a7a4b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Plugins/IngameDebugConsole/Scripts.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 860c08388401a6d4e858fe4910ea9337
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Plugins/IngameDebugConsole/Sprites.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cb5d7b23a9e684a41a6a5d4f300eb1e6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/Plugins/IngameDebugConsole/Sprites/Unused.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f6caae32d463529478f2186f47c2e3fe
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 16
- 1
Assets/Scenes/Server Scenes/ServerTestScene.unity View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0} m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1}
m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@ -424,6 +424,11 @@ PrefabInstance:
propertyPath: isSpawnable propertyPath: isSpawnable
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291,
type: 3}
propertyPath: SpawnDirection
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3} m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
--- !u!4 &308885819 stripped --- !u!4 &308885819 stripped
@ -1780,6 +1785,11 @@ PrefabInstance:
propertyPath: isSpawnable propertyPath: isSpawnable
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291,
type: 3}
propertyPath: SpawnDirection
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3} m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
--- !u!4 &1101212184 stripped --- !u!4 &1101212184 stripped
@ -1911,6 +1921,11 @@ PrefabInstance:
propertyPath: isSpawnable propertyPath: isSpawnable
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 8101348915751558870, guid: d7698c69246c64044ab2a94628bf0291,
type: 3}
propertyPath: SpawnDirection
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3} m_SourcePrefab: {fileID: 100100000, guid: d7698c69246c64044ab2a94628bf0291, type: 3}
--- !u!4 &1437209178 stripped --- !u!4 &1437209178 stripped

+ 29
- 2
Assets/Scripts/Block.cs View File

@ -18,9 +18,12 @@ public class Block : MonoBehaviour
[Tooltip("Can this type of block be walked on")] [Tooltip("Can this type of block be walked on")]
private bool _isWalkable = true; private bool _isWalkable = true;
[SerializeField]
[Tooltip("Can this block be spawned on")] [Tooltip("Can this block be spawned on")]
public bool isSpawnable = false; public bool isSpawnable = false;
[Tooltip("Direction Player is poting at when spawned")]
public Direction SpawnDirection = Direction.Forward;
#endregion InspectorFields #endregion InspectorFields
#region ReadOnly Properties #region ReadOnly Properties
@ -45,10 +48,34 @@ public class Block : MonoBehaviour
public bool isWalkable(LayerMask layerMask) public bool isWalkable(LayerMask layerMask)
{ {
//checks if there is no block above this one and that this is tagged as walkable //checks if there is no block above this one and that this is tagged as walkable
return (_isWalkable && !isBlockAtPosition(position + Vector3.up, 1, layerMask));
return (_isWalkable && !isBlockAtPosition(position + Vector3.up, 1, layerMask));
} }
#endregion Public Functions #endregion Public Functions
private void OnDrawGizmos()
{
if (!isSpawnable)
return;
Vector3 DrawPosition = VisualPosition + Vector3.up * 0.4f;
Vector3 Perp = Quaternion.Euler(0, 90, 0) * SpawnDirection.ToVector();
DebugExtensions.DrawCube(DrawPosition, 0.4f, Color.magenta, 0);
//Eyes
Vector3 eyePosition = DrawPosition + SpawnDirection.ToVector() * 0.4f;
DebugExtensions.DrawCube(eyePosition + Perp * 0.2f, 0.1f, Color.magenta, 0);
DebugExtensions.DrawCube(eyePosition - Perp * 0.2f, 0.1f, Color.magenta, 0);
//ears
Vector3 earPosition = DrawPosition + SpawnDirection.ToVector() * 0.2f + Vector3.up * 0.4f;
Vector3 earScale = Quaternion.LookRotation(SpawnDirection.ToVector()) * new Vector3(0.1f, 0.1f, 0.05f);
DebugExtensions.DrawCube(earPosition + Perp * 0.3f, earScale, Color.magenta, 0);
DebugExtensions.DrawCube(earPosition - Perp * 0.3f, earScale, Color.magenta, 0);
}
#region Static Functions #region Static Functions
/// <summary> /// <summary>

+ 8
- 0
Assets/Scripts/LogicBlocks.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8936b441d7647f74884c94f97bfb8931
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

+ 2
- 1
Assets/Scripts/Managers/GameManager.cs View File

@ -100,7 +100,7 @@ public class GameManager : MonoBehaviour
{ {
if (!player.waiting) if (!player.waiting)
{ {
player.client.Inventory.Remove(player.blockReader.CurrentBlock);
//player.client.Inventory.Remove(player.blockReader.CurrentBlock);
player.waiting = player.blockReader.Read(player.character, AnimationTime); player.waiting = player.blockReader.Read(player.character, AnimationTime);
} }
} }
@ -146,6 +146,7 @@ public class GameManager : MonoBehaviour
Character newChar = Instantiate(characterPrefab); Character newChar = Instantiate(characterPrefab);
Block startingBlock = SpawnBlocks[(spawnIndex++ % ClientList.ConnectedClients.Count)]; Block startingBlock = SpawnBlocks[(spawnIndex++ % ClientList.ConnectedClients.Count)];
newChar.Initialise(startingBlock, client.Inventory, client.characterAnimal); newChar.Initialise(startingBlock, client.Inventory, client.characterAnimal);
newChar.transform.forward = startingBlock.SpawnDirection.ToVector();
playerData.Add(client.ID, new PlayerData(newChar,client)); playerData.Add(client.ID, new PlayerData(newChar,client));
} }
} }

Loading…
Cancel
Save