Browse Source

Started implementing logic blocks

Josh_Dev_branch
Joshua Reason 5 years ago
parent
commit
3bf96bdbd6
18 changed files with 217 additions and 1 deletions
  1. +8
    -0
      Assets/Scripts.meta
  2. +8
    -0
      Assets/Scripts/Logic.meta
  3. +8
    -0
      Assets/Scripts/Logic/Blocks.meta
  4. +62
    -0
      Assets/Scripts/Logic/Blocks/LogicBlock.cs
  5. +11
    -0
      Assets/Scripts/Logic/Blocks/LogicBlock.cs.meta
  6. +19
    -0
      Assets/Scripts/Logic/Blocks/Move.cs
  7. +11
    -0
      Assets/Scripts/Logic/Blocks/Move.cs.meta
  8. +29
    -0
      Assets/Scripts/Logic/Blocks/Rotate.cs
  9. +11
    -0
      Assets/Scripts/Logic/Blocks/Rotate.cs.meta
  10. +8
    -0
      Assets/World Assets.meta
  11. +8
    -0
      Assets/World Assets/Logic Blocks.meta
  12. +3
    -0
      Assets/World Assets/Logic Blocks/Move.asset
  13. +8
    -0
      Assets/World Assets/Logic Blocks/Move.asset.meta
  14. +3
    -0
      Assets/World Assets/Logic Blocks/Rotate Left.asset
  15. +8
    -0
      Assets/World Assets/Logic Blocks/Rotate Left.asset.meta
  16. +3
    -0
      Assets/World Assets/Logic Blocks/Rotate Right.asset
  17. +8
    -0
      Assets/World Assets/Logic Blocks/Rotate Right.asset.meta
  18. +1
    -1
      ProjectSettings/ProjectVersion.txt

+ 8
- 0
Assets/Scripts.meta View File

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

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

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

+ 8
- 0
Assets/Scripts/Logic/Blocks.meta View File

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

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

@ -0,0 +1,62 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Base class all logic blocks are derived from
/// </summary>
[System.Serializable]
public abstract class LogicBlock : ScriptableObject
{
#region Inspector Fields
[SerializeField]
[Header("Base Settings")]
[Tooltip("Wait until this block is resolved before moving to next")]
protected bool WaitUntilFinished = false;
[SerializeField]
[Tooltip("Amount of times to run this Block before moving to next")]
protected int RepeatAmount = 1;
#endregion Inspector Fields
#region private variables
/// <summary>
/// Amount of times this block has run
/// </summary>
protected int RepeatCount = 0;
#endregion private variables
#region Class Functions
/// <summary>
/// Runs the block
/// </summary>
/// <returns>returns true if block is finished</returns>
public virtual bool Run()
{
RepeatCount++;
BlockLogic();
return (RepeatCount == RepeatAmount);
}
/// <summary>
/// Returns the amount of space this logic block takes up
/// </summary>
/// <returns>Int which controlls how much space this takes up</returns>
public virtual int Size()
{
return 1;
}
/// <summary>
/// Where derived callses should implement the logic for their classes
/// </summary>
/// <returns>returns true if block is finished</returns>
protected abstract void BlockLogic();
#endregion Class Functions
}

+ 11
- 0
Assets/Scripts/Logic/Blocks/LogicBlock.cs.meta View File

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

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

@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Logic block which deals with moving a character in a direction
/// </summary>
[CreateAssetMenu(menuName = "Major Project/Move Block")]
public class Move : LogicBlock
{
#region Class Functions
protected override void BlockLogic()
{
Debug.Log("Move");
}
#endregion Class Functions
}

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

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

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

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Logic block which deals with moving a character in a direction
/// </summary>
[CreateAssetMenu(menuName = "Major Project/Rotate Block")]
public class Rotate : LogicBlock
{
public enum Direction { Left, Right}
#region Inspector Fields
[SerializeField]
[Header("Rotate Settings")]
[Tooltip("Direction to rotate in")]
protected Direction direction;
#endregion Inspector Fields
#region Class Functions
protected override void BlockLogic()
{
Debug.Log("Rotate " + direction.ToString());
}
#endregion Class Functions
}

+ 11
- 0
Assets/Scripts/Logic/Blocks/Rotate.cs.meta View File

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

+ 8
- 0
Assets/World Assets.meta View File

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

+ 8
- 0
Assets/World Assets/Logic Blocks.meta View File

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

+ 3
- 0
Assets/World Assets/Logic Blocks/Move.asset View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8f30f384f120eeb69292d9ff04a9e267e536ef80a35c6a7820a032e88257d9e8
size 434

+ 8
- 0
Assets/World Assets/Logic Blocks/Move.asset.meta View File

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

+ 3
- 0
Assets/World Assets/Logic Blocks/Rotate Left.asset View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:323f3c70cf40755730cb81a31da6a58931177674b836d0b5bbc8b9f88af4b447
size 456

+ 8
- 0
Assets/World Assets/Logic Blocks/Rotate Left.asset.meta View File

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

+ 3
- 0
Assets/World Assets/Logic Blocks/Rotate Right.asset View File

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

+ 8
- 0
Assets/World Assets/Logic Blocks/Rotate Right.asset.meta View File

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

+ 1
- 1
ProjectSettings/ProjectVersion.txt View File

@ -1 +1 @@
m_EditorVersion: 2018.3.7f1
m_EditorVersion: 2018.3.4f1

Loading…
Cancel
Save