Browse Source

Started working on equality for blocks fixed jump waiting

Josh_Dev_branch
JoshuaReason 5 years ago
parent
commit
a9a86b3252
6 changed files with 47 additions and 8 deletions
  1. +3
    -0
      Assets/Data/Logic Blocks/U-Turn.asset
  2. +8
    -0
      Assets/Data/Logic Blocks/U-Turn.asset.meta
  3. +1
    -1
      Assets/Scripts/Logic/BlockReader.cs
  4. +17
    -4
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  5. +13
    -0
      Assets/Scripts/Logic/Blocks/Move.cs
  6. +5
    -3
      Assets/Scripts/Managers/GameManager.cs

+ 3
- 0
Assets/Data/Logic Blocks/U-Turn.asset View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:20daf275a96f6c1909034cff9a3cc39f2636f25983e408ed050d69d8d18a37c8
size 537

+ 8
- 0
Assets/Data/Logic Blocks/U-Turn.asset.meta View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b5887451436a375419e538ef3706ecf9
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

+ 1
- 1
Assets/Scripts/Logic/BlockReader.cs View File

@ -72,7 +72,7 @@ public class BlockReader
} }
//Should other readers wait for this one //Should other readers wait for this one
return (currentBlock.isFinished() || !currentBlock.WaitUntilFinished);
return (currentBlock.isFinished() || currentBlock.WaitUntilFinished);
} }
/// <summary> /// <summary>

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

@ -31,7 +31,7 @@ public abstract class LogicBlock : ScriptableObject
#endregion Inspector Fields #endregion Inspector Fields
#region ReadOnly Variables #region ReadOnly Variables
public string DisplayName { get {return (string.IsNullOrEmpty(_DisplayName)) ? name : _DisplayName; } }
public string DisplayName { get { return (string.IsNullOrEmpty(_DisplayName)) ? name : _DisplayName; } }
#endregion #endregion
#region private variables #region private variables
@ -80,7 +80,7 @@ public abstract class LogicBlock : ScriptableObject
/// <param name="transform">transform function will be based off</param> /// <param name="transform">transform function will be based off</param>
/// <param name="layerMask">layers to ignore</param> /// <param name="layerMask">layers to ignore</param>
/// <returns>block which character will finish on after performing this function </returns> /// <returns>block which character will finish on after performing this function </returns>
public abstract Block GetEndBlock(Block startBlock,Transform transform, LayerMask layerMask);
public abstract Block GetEndBlock(Block startBlock, Transform transform, LayerMask layerMask);
/// <summary> /// <summary>
/// Resets the block to be ready to used again /// Resets the block to be ready to used again
@ -134,6 +134,19 @@ public abstract class LogicBlock : ScriptableObject
#endregion Serialisation Functions #endregion Serialisation Functions
public override bool Equals(object other)
{
if (Object.ReferenceEquals(null, other))
return false;
if (Object.ReferenceEquals(other.GetType(), other))
return false;
LogicBlock otherLogic = other as LogicBlock;
return !Object.ReferenceEquals(null, otherLogic)
&& int.Equals(RepeatCount, otherLogic.RepeatCount);
}
public virtual void OnDoubleClick() public virtual void OnDoubleClick()
{ {
@ -165,8 +178,8 @@ public class BlockToken
public LogicBlock ToLogicBlock() public LogicBlock ToLogicBlock()
{ {
LogicBlock retVal = (LogicBlock) ScriptableObject.CreateInstance(blockType);
LogicBlock retVal = (LogicBlock)ScriptableObject.CreateInstance(blockType);
Debug.Log("type: " + retVal.GetType()); Debug.Log("type: " + retVal.GetType());
retVal.CopyToken(this); retVal.CopyToken(this);

+ 13
- 0
Assets/Scripts/Logic/Blocks/Move.cs View File

@ -69,6 +69,19 @@ public class Move : LogicBlock
return retVal; return retVal;
} }
public override bool Equals(object other)
{
if (Object.ReferenceEquals(null, other))
return false;
if (Object.ReferenceEquals(other.GetType(), other))
return false;
Move otherMove = other as Move;
return base.Equals(other)&& Direction.Equals(direction, otherMove.direction);
}
#endregion Class Functions #endregion Class Functions
} }

+ 5
- 3
Assets/Scripts/Managers/GameManager.cs View File

@ -124,10 +124,12 @@ public class GameManager : MonoBehaviour
gamemode.RoundEnd(playerArray.ToArray()); gamemode.RoundEnd(playerArray.ToArray());
foreach (PlayerData player in playerArray) foreach (PlayerData player in playerArray)
{
player.blockReader.Reset(); player.blockReader.Reset();
ClientList.ForEach(p => p.SendInventory());
ClientList.ForEach(p => p.ChangeScene("ClientScene"));
player.waiting = false;
player.client.SendInventory();
player.client.ChangeScene("ClientScene");
}
Debug.Log("Finished Moving"); Debug.Log("Finished Moving");
StartRound(); StartRound();
} }

Loading…
Cancel
Save