Browse Source

Merge branch 'master' of https://bitbucket.org/JoshuaReason/major-project-a

# Conflicts:
#	Assets/Prefabs/Map Sections/Start 4-player.prefab
#	Assets/Scripts/Character.cs
master
Joshua Reason 4 years ago
parent
commit
07946d34b2
6 changed files with 3143 additions and 6140 deletions
  1. +3043
    -5776
      Assets/Prefabs/Map Sections/Start 4-player.prefab
  2. +39
    -175
      Assets/Prefabs/Traps/Conveyor Belt with Cube.prefab
  3. +1
    -138
      Assets/Prefabs/Traps/ShootingCannon + Block.prefab
  4. +1
    -0
      Assets/Scripts/LevelBlocks/Block.cs
  5. +1
    -1
      Assets/Scripts/Traps/ShootingCannon.cs
  6. +58
    -50
      Assets/Scripts/blockSpawn.cs

+ 3043
- 5776
Assets/Prefabs/Map Sections/Start 4-player.prefab
File diff suppressed because it is too large
View File


+ 39
- 175
Assets/Prefabs/Traps/Conveyor Belt with Cube.prefab View File

@ -11,8 +11,6 @@ GameObject:
- component: {fileID: 4490968977809283}
- component: {fileID: 33922994427887733}
- component: {fileID: 23937057364958257}
- component: {fileID: 3845129242341207909}
- component: {fileID: 5867501616828889193}
m_Layer: 0
m_Name: Cube_GroundWGrass
m_TagString: Coloured
@ -30,9 +28,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: -0.5, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4721099854274309}
- {fileID: 4721099527720510}
m_Children: []
m_Father: {fileID: 437627090}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -81,40 +77,6 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &3845129242341207909
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1141755146290067}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1.0000005, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &5867501616828889193
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1141755146290067}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6692f0c965cb4fa41b616ba0991653a3, type: 3}
m_Name:
m_EditorClassIdentifier:
VisualOffset: {x: 0, y: 0, z: 0}
is_Walkable: 1
isWater: 0
isPit: 0
isCrystals: 0
isRock: 0
isSpawnable: 0
SpawnDirection: 2
Action: {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2}
--- !u!1 &2430657395993931422
GameObject:
m_ObjectHideFlags: 0
@ -124,6 +86,8 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 437627090}
- component: {fileID: 1806707899937284459}
- component: {fileID: 7417423694022785374}
m_Layer: 0
m_Name: Conveyor Belt with Cube
m_TagString: Untagged
@ -147,6 +111,40 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &1806707899937284459
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2430657395993931422}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &7417423694022785374
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2430657395993931422}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6692f0c965cb4fa41b616ba0991653a3, type: 3}
m_Name:
m_EditorClassIdentifier:
VisualOffset: {x: 0, y: 0, z: 0}
is_Walkable: 1
isWater: 0
isPit: 0
isCrystals: 0
isRock: 0
isSpawnable: 0
SpawnDirection: 2
Action: {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2}
--- !u!1 &3424486742927057916
GameObject:
m_ObjectHideFlags: 0
@ -172,13 +170,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3424486742927057916}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0.51, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 437627090}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!33 &1376194202737726602
MeshFilter:
m_ObjectHideFlags: 0
@ -224,137 +222,3 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!1001 &589977586
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4490968977809283}
m_Modifications:
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_Name
value: Cube_GroundL
objectReference: {fileID: 0}
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.y
value: -2
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!4 &4721099527720510 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07,
type: 3}
m_PrefabInstance: {fileID: 589977586}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &816154313
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4490968977809283}
m_Modifications:
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_Name
value: Cube_GroundU
objectReference: {fileID: 0}
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!4 &4721099854274309 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07,
type: 3}
m_PrefabInstance: {fileID: 816154313}
m_PrefabAsset: {fileID: 0}

+ 1
- 138
Assets/Prefabs/Traps/ShootingCannon + Block.prefab View File

@ -29,9 +29,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4541774030144991256}
- {fileID: 4541774030055075990}
m_Children: []
m_Father: {fileID: 6179448856766749153}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -153,7 +151,6 @@ MonoBehaviour:
type: 3}
spawnLocation: {fileID: 6183695074135418386}
counter: {fileID: 7559508468311915784}
countdowntimer: 3
--- !u!1 &6180422965807075217
GameObject:
m_ObjectHideFlags: 0
@ -529,137 +526,3 @@ MonoBehaviour:
- {fileID: 0}
- {fileID: 0}
m_maskType: 0
--- !u!1001 &4546202104718436698
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4546202105378142430}
m_Modifications:
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_Name
value: Cube_GroundL
objectReference: {fileID: 0}
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.y
value: -2
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!4 &4541774030055075990 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07,
type: 3}
m_PrefabInstance: {fileID: 4546202104718436698}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &4546202104896956884
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 4546202105378142430}
m_Modifications:
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_Name
value: Cube_GroundU
objectReference: {fileID: 0}
- target: {fileID: 1133981147424236, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.y
value: -1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e5fac62723232674aa487c9073f1ca07, type: 3}
--- !u!4 &4541774030144991256 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4721099042904524, guid: e5fac62723232674aa487c9073f1ca07,
type: 3}
m_PrefabInstance: {fileID: 4546202104896956884}
m_PrefabAsset: {fileID: 0}

+ 1
- 0
Assets/Scripts/LevelBlocks/Block.cs View File

@ -26,6 +26,7 @@ public class Block : MonoBehaviour
public bool isCrystals = false;
public bool isRock = false;
public bool isCollectableSpawnable = false;
[Header("Spawn Settings")]
[Tooltip("Can this block be spawned on")]

+ 1
- 1
Assets/Scripts/Traps/ShootingCannon.cs View File

@ -11,7 +11,7 @@ public class ShootingCannon : ActiveBlock
public GameObject shootingObject;
public Transform spawnLocation;
public TextMeshPro counter;
public int countdowntimer;
int countdowntimer = 3;
int countdown;
public override int GetInitative()

+ 58
- 50
Assets/Scripts/blockSpawn.cs View File

@ -6,68 +6,74 @@ using Networking.Server;
public class blockSpawn : MonoBehaviour
{
[SerializeField]
public Inventory.Data[] spawnLogicList;
public Inventory.Data[] StrongLogicList;
public Inventory.Data[] NormalLogicList;
public Inventory.Data[] WeakLogicList;
Inventory.Data[] listtoUse;
List<ClientData> ConnectedClients;
public ClientList clientDataList;
public Block[] SpawnBlocks;
List<Vector3> spawnedLocations;
int min_z = -2, max_z = 2;
Vector3 spawnposition = new Vector3(0, 0, 0);
List<Block> possibleSpawnLocations;
int spawnNumber = 2;
void Awake()
{
ConnectedClients = clientDataList.ConnectedClients;
spawnedLocations = new List<Vector3>();
possibleSpawnLocations = new List<Block>();
}
public void wakeup()
{
SpawnBlocks = FindObjectsOfType<Block>().Where(p => p.is_Walkable).ToArray();
SpawnBlocks = FindObjectsOfType<Block>().Where(p => p.isCollectableSpawnable).ToArray();
}
public void Spawn()
{
/*
Get all player locations, get leader(biggest x position value) and min value
+2 to each value, set as min and man in random.range()
add locations to a list to ensure no duplicates
check not over pit or hole
*/
//Sort play locations so leader is first
ConnectedClients.Sort((b, a) => a.playerCharacter.transform.position.x.CompareTo(b.playerCharacter.transform.position.x));
int min_x = (int)ConnectedClients[ConnectedClients.Count - 1].playerCharacter.transform.position.x + 2;
//add two to each to set bounds
int min_x = (int)ConnectedClients[ConnectedClients.Count - 1].playerCharacter.transform.position.x + 3;
int max_x = (int)ConnectedClients[0].playerCharacter.transform.position.x + 2;
for(int i = 0; i < 2; i++)
//Check points within the bounds of players
foreach(Block point in SpawnBlocks)
{
spawnposition = new Vector3(Random.Range(min_x, max_x), -0.5f, Random.Range(min_z, max_z));
checkLocation(spawnposition);
if(point.transform.position.x > min_x && point.transform.position.x < max_x)
{
possibleSpawnLocations.Add(point);
}
}
//pick a random value from those available, checks the location
//then removes it to remove the possibility of duplicates
while(spawnNumber > 0)
{
int choice = Random.Range(0, possibleSpawnLocations.Count - 1);
bool spawned = checkLocation(possibleSpawnLocations[choice].transform.position);
if (spawned == true)
{
possibleSpawnLocations.RemoveAt(choice);
spawnNumber--;
}
}
spawnNumber = 2;
}
private void checkLocation(Vector3 spawnposition)
private bool checkLocation(Vector3 spawnposition)
{
bool duplicate = checkDuplicatePosition(spawnposition);
if (duplicate == false)
{
bool valid = checkValid(spawnposition);
if (valid == true)
{
spawnBlock(spawnposition);
}
else
{
//Block clostest = Utility.minBy(SpawnBlocks, p => Vector3.Distance(p.transform.position, spawnposition));
//checkLocation(new Vector3(spawnposition.x, spawnposition.y + 1.5f, spawnposition.z));
Debug.Log("Fail one");
}
spawnBlock(spawnposition);
return true;
}
else
{
//this needs to be changed
//Block clostest = Utility.minBy(SpawnBlocks, p => Vector3.Distance(p.transform.position, spawnposition));
//checkLocation(new Vector3(spawnposition.x, spawnposition.y + 1.5f, spawnposition.z));
Debug.Log("Fail two");
Debug.Log("Fail to spawn - duplicate positioning");
return false;
}
}
@ -86,30 +92,32 @@ public class blockSpawn : MonoBehaviour
return false;
}
private bool checkValid(Vector3 spawnposition)
{
//is over a walkable block
for (int i = 0; i < SpawnBlocks.Length; i++)
{
if (SpawnBlocks[i].position.x == spawnposition.x && SpawnBlocks[i].position.z == spawnposition.z)
{
return true;
}
}
return false;
}
private void spawnBlock(Vector3 spawnposition)
{
GameObject prefab = Resources.Load("Logic Block") as GameObject;
GameObject block = Instantiate(prefab);
spawnposition.y += 1.5f;
int number = (int)Random.Range(1.0f, spawnLogicList.Length);
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.element = spawnLogicList[number].element;
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.Count = spawnLogicList[number].Count;
block.transform.position = spawnposition;
//Debug.Log("Instantiated new logic block: " + spawnLogicList[number].element + " at position: " + block.transform.position);
spawnedLocations.Add(spawnposition);
}
public void assignLogicBlock(GameObject block, float value)
{
if(value > 0)
{
listtoUse = WeakLogicList;
}
else if (value < 0 && value > (-10))
{
listtoUse = NormalLogicList;
}
else if (value <= (-10))
{
listtoUse = StrongLogicList;
}
int number = (int)Random.Range(0, listtoUse.Length-1);
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.element = listtoUse[number].element;
block.GetComponent<LogicCollectable_Multiplayer>().Collectable.Count = listtoUse[number].Count;
}
}

Loading…
Cancel
Save