Browse Source

Conveyorbelt works

master
Joshua Reason 4 years ago
parent
commit
5ee1be61f3
11 changed files with 2001 additions and 1273 deletions
  1. +1862
    -1098
      Assets/Prefabs/Map Sections/Start 4-player.prefab
  2. +110
    -31
      Assets/Prefabs/Traps/Conveyor Belt.prefab
  3. +2
    -2
      Assets/Scripts/Logic/Blocks/CombinedBlock.cs
  4. +1
    -1
      Assets/Scripts/Logic/Blocks/Jump.cs
  5. +4
    -4
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  6. +8
    -3
      Assets/Scripts/Logic/Blocks/Move.cs
  7. +1
    -1
      Assets/Scripts/Logic/Blocks/Rotate.cs
  8. +1
    -1
      Assets/Scripts/Logic/Blocks/RotateHalf.cs
  9. +12
    -48
      Assets/Scripts/Traps/ConveyorBelt.cs
  10. +0
    -73
      Assets/Scripts/Traps/Traps.cs
  11. +0
    -11
      Assets/Scripts/Traps/Traps.cs.meta

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


+ 110
- 31
Assets/Prefabs/Traps/Conveyor Belt.prefab View File

@ -9,7 +9,6 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 6885336512813422994}
- component: {fileID: 2418273759298412065}
m_Layer: 0
m_Name: Conveyor Belt
m_TagString: Untagged
@ -25,30 +24,14 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2418273759298412064}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 6987869042214125455}
- {fileID: 534819064938385325}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2418273759298412065
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2418273759298412064}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6692f0c965cb4fa41b616ba0991653a3, type: 3}
m_Name:
m_EditorClassIdentifier:
clientData: {fileID: 11400000, guid: ded0b21c3ef1e7049a1128c12e9401fe, type: 2}
Names: []
left: 0
forward: 0
triggeranimate: 0
--- !u!1 &6298733943245737397
GameObject:
m_ObjectHideFlags: 0
@ -60,7 +43,6 @@ GameObject:
- component: {fileID: 534819064938385325}
- component: {fileID: 4321558135700899541}
- component: {fileID: 3879023477559693693}
- component: {fileID: 8557379418806623069}
m_Layer: 0
m_Name: Plane
m_TagString: Untagged
@ -75,13 +57,13 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6298733943245737397}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 1.001, z: 0}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_Children: []
m_Father: {fileID: 6885336512813422994}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0}
--- !u!33 &4321558135700899541
MeshFilter:
m_ObjectHideFlags: 0
@ -127,17 +109,114 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!64 &8557379418806623069
MeshCollider:
--- !u!1 &6985680290830869407
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6298733943245737397}
serializedVersion: 6
m_Component:
- component: {fileID: 6987869042214125455}
- component: {fileID: 6957662942793179257}
- component: {fileID: 6963440224797293629}
- component: {fileID: 6172946288132706153}
- component: {fileID: 2374503586603424332}
m_Layer: 0
m_Name: Cube_GroundWGrass
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 4294967295
m_IsActive: 1
--- !u!4 &6987869042214125455
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6985680290830869407}
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: []
m_Father: {fileID: 6885336512813422994}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &6957662942793179257
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6985680290830869407}
m_Mesh: {fileID: 4300000, guid: d73f25ac0bcef5b469863e30ce33634b, type: 3}
--- !u!23 &6963440224797293629
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6985680290830869407}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a12203d8d2df33d4f814e1a381ba565f, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!65 &6172946288132706153
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6985680290830869407}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 0
m_CookingOptions: 14
m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
serializedVersion: 2
m_Size: {x: 1, y: 1.0000005, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &2374503586603424332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6985680290830869407}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6692f0c965cb4fa41b616ba0991653a3, type: 3}
m_Name:
m_EditorClassIdentifier:
VisualOffset: {x: 0, y: 0.5, z: 0}
is_Walkable: 1
isWater: 0
isPit: 0
isSpawnable: 0
SpawnDirection: 2
Action: {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2}

+ 2
- 2
Assets/Scripts/Logic/Blocks/CombinedBlock.cs View File

@ -25,7 +25,7 @@ public class CombinedBlock : LogicBlock
#endregion Private Variables
public override IEnumerator Run(Character player, float animationTime)
public override IEnumerator Run(Character player, float animationTime, bool useBlockDirection = false)
{
BlockLogic(player,animationTime);
@ -49,7 +49,7 @@ public class CombinedBlock : LogicBlock
}
}
protected override IEnumerator BlockLogic(Character player, float animationTime)
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
yield break;
}

+ 1
- 1
Assets/Scripts/Logic/Blocks/Jump.cs View File

@ -28,7 +28,7 @@ public class Jump : LogicBlock
/// Implementation of BlockLogic, moves the player forward
/// </summary>
/// <param name="player">Player to move</param>
protected override IEnumerator BlockLogic(Character player, float animationTime)
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
//player.Jump(direction, animationTime);

+ 4
- 4
Assets/Scripts/Logic/Blocks/LogicBlock.cs View File

@ -60,7 +60,7 @@ public abstract class LogicBlock : ScriptableObject
/// </summary>
/// <param name="player">Player which will be affected by the block</param>
/// <returns>returns true if block is finished</returns>
public virtual IEnumerator Run(Character player, float animationSpeed)
public virtual IEnumerator Run(Character player, float animationSpeed,bool useBlockDirection = false)
{
float TotalAnimationTime = animationSpeed / SpeedMultiplier;
@ -77,13 +77,13 @@ public abstract class LogicBlock : ScriptableObject
if (player.stuck)
yield break;
RepeatCount++;
yield return player.StartCoroutine(BlockLogic(player, TotalAnimationTime));
yield return player.StartCoroutine(BlockLogic(player, TotalAnimationTime, useBlockDirection));
}
}
else
{
RepeatCount++;
yield return player.StartCoroutine(BlockLogic(player, TotalAnimationTime));
yield return player.StartCoroutine(BlockLogic(player, TotalAnimationTime, useBlockDirection));
}
}
@ -101,7 +101,7 @@ public abstract class LogicBlock : ScriptableObject
/// </summary>
/// <param name="player">Player which will be affected by the block</param>
/// <returns>returns true if block is finished</returns>
protected abstract IEnumerator BlockLogic(Character player, float animationTime);
protected abstract IEnumerator BlockLogic(Character player, float animationTime,bool useBlockDirection = false);
/// <summary>
/// Returns the block that the character will endUp on after they use this logic element

+ 8
- 3
Assets/Scripts/Logic/Blocks/Move.cs View File

@ -19,11 +19,16 @@ public class Move : LogicBlock
/// Implementation of BlockLogic, moves the player forward
/// </summary>
/// <param name="player">Player to move</param>
protected override IEnumerator BlockLogic(Character player, float animationTime)
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
player.justMoved = true;
//player.Move(direction, animationTime);
Block endBlock = GetEndBlock(player.CurrentBlock, player.transform, ~player.Ignore);
Block endBlock;
if (useBlockDirection)
endBlock = GetEndBlock(player.CurrentBlock, player.CurrentBlock.transform, ~player.Ignore);
else
endBlock = GetEndBlock(player.CurrentBlock, player.transform, ~player.Ignore);
yield return player.StartCoroutine(player.MoveToBlock(endBlock, Character.Animation.Walk, animationTime));
}

+ 1
- 1
Assets/Scripts/Logic/Blocks/Rotate.cs View File

@ -23,7 +23,7 @@ public class Rotate : LogicBlock
/// Rotates the player in the direction specified by this block
/// </summary>
/// <param name="player">Player to rotate</param>
protected override IEnumerator BlockLogic(Character player, float animationTime)
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
//player.Rotate(direction, animationTime);

+ 1
- 1
Assets/Scripts/Logic/Blocks/RotateHalf.cs View File

@ -23,7 +23,7 @@ public class RotateHalf : LogicBlock
/// Rotates the player in the direction specified by this block
/// </summary>
/// <param name="player">Player to rotate</param>
protected override IEnumerator BlockLogic(Character player, float animationTime)
protected override IEnumerator BlockLogic(Character player, float animationTime, bool useBlockDirection = false)
{
player.RotateHalf(direction, animationTime);
yield break;

+ 12
- 48
Assets/Scripts/Traps/ConveyorBelt.cs View File

@ -4,63 +4,27 @@ using UnityEngine;
using Networking.Client;
using Networking.Server;
public class ConveyorBelt : MonoBehaviour
public class ConveyorBelt : ActiveBlock
{
public ClientList clientData;
bool characterOnBelt = false;
GameObject player;
string charname;
public List<string> Names = new List<string>();
public bool left;
public bool forward;
public bool triggeranimate;
[Header("Conveyor Settings")]
[SerializeField]
public LogicBlock Action;
private void Start()
public override int GetInitative()
{
for (int i = 0; i < clientData.ConnectedClients.Count; i++)
{
Names.Add(clientData.ConnectedClients[i].characterAnimal + "(Clone)");
}
}
private void Update()
{
return 5;
}
void OnTriggerEnter(Collider other)
public override IEnumerator OnEnvironmentTurn(PlayerData[] allPlayers)
{
for (int i = 0; i < Names.Count; i++)
if (CurrentPlayer != null)
{
if (other.gameObject.name == Names[i])
{
characterOnBelt = true;
charname = other.gameObject.name;
}
}
}
Debug.Log("currentPlayer: " + CurrentPlayer);
yield return StartCoroutine(Action.Run(CurrentPlayer, 1,true));
public void Animate()
{
player = GameObject.Find(charname);
if(forward == true)
{
player.GetComponent<Character>().conveyorMoveForward(Direction.Forward, 1.0f);
}
else if (forward == false)
{
player.GetComponent<Character>().conveyorMoveBackward(Direction.Back, 1.0f);
}
if (left == true)
{
player.GetComponent<Character>().conveyorMoveLeft(Direction.Left, 1.0f);
}
else if (left == false)
{
player.GetComponent<Character>().conveyorMoveRight(Direction.Right, 1.0f);
}
isFinished = true;
}
}

+ 0
- 73
Assets/Scripts/Traps/Traps.cs View File

@ -1,73 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Traps : MonoBehaviour
{
public List<ConveyorBelt> ConveyorBelts = new List<ConveyorBelt>();
public List<CrushingBoulder> CrushingBoulders = new List<CrushingBoulder>();
public List<CubeWithCrystals> CubesWithCrystals = new List<CubeWithCrystals>();
public List<FloatingOnWater> FloatingOnWater = new List<FloatingOnWater>();
public List<InGroundTrap> InGroundTraps = new List<InGroundTrap>();
public List<ShootingCannon> ShootingCannons = new List<ShootingCannon>();
private void Start()
{
ConveyorBelts.AddRange(GameObject.FindObjectsOfType<ConveyorBelt>());
CrushingBoulders.AddRange(GameObject.FindObjectsOfType<CrushingBoulder>());
CubesWithCrystals.AddRange(GameObject.FindObjectsOfType<CubeWithCrystals>());
FloatingOnWater.AddRange(GameObject.FindObjectsOfType<FloatingOnWater>());
InGroundTraps.AddRange(GameObject.FindObjectsOfType<InGroundTrap>());
ShootingCannons.AddRange(GameObject.FindObjectsOfType<ShootingCannon>());
}
public void environmentTurn()
{
if (ConveyorBelts.Count > 0)
{
foreach(ConveyorBelt belt in ConveyorBelts)
{
belt.Animate();
}
}
if (CrushingBoulders.Count > 0)
{
foreach (CrushingBoulder boulder in CrushingBoulders)
{
boulder.Animate();
}
}
if (ShootingCannons.Count > 0)
{
foreach (ShootingCannon cannon in ShootingCannons)
{
cannon.Animate();
}
}
}
public void environmentRound()
{
if (CubesWithCrystals.Count > 0)
{
foreach (CubeWithCrystals crystal in CubesWithCrystals)
{
crystal.Animate();
}
}
if (FloatingOnWater.Count > 0)
{
foreach (FloatingOnWater water in FloatingOnWater)
{
water.Animate();
}
}
if (InGroundTraps.Count > 0)
{
foreach (InGroundTrap ground in InGroundTraps)
{
ground.Animate();
}
}
}
}

+ 0
- 11
Assets/Scripts/Traps/Traps.cs.meta View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 612f47a9f74b2694d8625347d8656417
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save