Browse Source

-For Loop

-Jump Block
-Pro tools
Josh_Dev_branch
JoshuaReason 5 years ago
parent
commit
6320a8cbe8
14 changed files with 199 additions and 12 deletions
  1. +3
    -0
      Assets/Logic Blocks/ForLoop.asset
  2. +8
    -0
      Assets/Logic Blocks/ForLoop.asset.meta
  3. +3
    -0
      Assets/Logic Blocks/Jump.asset
  4. +8
    -0
      Assets/Logic Blocks/Jump.asset.meta
  5. +8
    -0
      Assets/Models.meta
  6. +45
    -1
      Assets/Scenes/TuteLevelFive.unity
  7. +23
    -0
      Assets/Scripts/BlockInput.cs
  8. +11
    -0
      Assets/Scripts/BlockInput.cs.meta
  9. +4
    -7
      Assets/Scripts/Logic/BlockReader.cs
  10. +34
    -3
      Assets/Scripts/Logic/Blocks/CombinedBlock.cs
  11. +28
    -0
      Assets/Scripts/Logic/Blocks/Jump.cs
  12. +11
    -0
      Assets/Scripts/Logic/Blocks/Jump.cs.meta
  13. +8
    -0
      Assets/Scripts/LogicBlocks.meta
  14. +5
    -1
      Packages/manifest.json

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

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

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

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

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

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

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

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

+ 8
- 0
Assets/Models.meta View File

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

+ 45
- 1
Assets/Scenes/TuteLevelFive.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.4465785, g: 0.49641222, b: 0.57481694, 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:
@ -1517,6 +1517,11 @@ PrefabInstance:
propertyPath: nextScene propertyPath: nextScene
value: value:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2631002120179805110, guid: c176f4ae8f7b4074db99b27b2e015a2a,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1116712125457233699, guid: c176f4ae8f7b4074db99b27b2e015a2a, - target: {fileID: 1116712125457233699, guid: c176f4ae8f7b4074db99b27b2e015a2a,
type: 3} type: 3}
propertyPath: m_Materials.Array.data[0] propertyPath: m_Materials.Array.data[0]
@ -3475,6 +3480,45 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: bf82e6870e62966448210c1718aa3fb3, type: 3} m_SourcePrefab: {fileID: 100100000, guid: bf82e6870e62966448210c1718aa3fb3, type: 3}
--- !u!1 &1510348215 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7426725930156175983, guid: c176f4ae8f7b4074db99b27b2e015a2a,
type: 3}
m_PrefabInstance: {fileID: 421711684}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1510348216
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1510348215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0bbbf19cb68b2742bd80855243b64e3, type: 3}
m_Name:
m_EditorClassIdentifier:
character: {fileID: 1510348219}
blockReader:
LogicChain:
- {fileID: 11400000, guid: 48f0ea7af28c10846b5b76ce70d06b60, type: 2}
- {fileID: 11400000, guid: 48f0ea7af28c10846b5b76ce70d06b60, type: 2}
- {fileID: 11400000, guid: aa238796cf1886244951ec8c2fed1855, type: 2}
- {fileID: 11400000, guid: 0b1bcd75cb7dade4fb598ee3412594c2, type: 2}
- {fileID: 11400000, guid: 41f4cb946475b2849a802a8297d81e25, type: 2}
- {fileID: 11400000, guid: 194f051bd7d3e7d4fb5b96a8e1d5b162, type: 2}
--- !u!114 &1510348219 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 2862111851184665482, guid: c176f4ae8f7b4074db99b27b2e015a2a,
type: 3}
m_PrefabInstance: {fileID: 421711684}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1510348215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 73c2eff8a9a01a44bb9b2c007539fc60, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1510549798 --- !u!1001 &1510549798
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

+ 23
- 0
Assets/Scripts/BlockInput.cs View File

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BlockInput : MonoBehaviour
{
public Character character;
public BlockReader blockReader;
public void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
ReadNext();
}
[ContextMenu ("Read Next")]
public void ReadNext()
{
blockReader.Read(character);
}
}

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

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

+ 4
- 7
Assets/Scripts/Logic/BlockReader.cs View File

@ -5,14 +5,11 @@ using UnityEngine;
/// <summary> /// <summary>
/// Class which reads a a list of logic blocks and applies to a character /// Class which reads a a list of logic blocks and applies to a character
/// </summary> /// </summary>
public class BlockReader : MonoBehaviour
[System.Serializable]
public class BlockReader
{ {
#region Inspector Variables #region Inspector Variables
[SerializeField]
[Tooltip("Character to be controllered by the Logic Chain")]
protected Character character;
[SerializeField] [SerializeField]
[Tooltip("List of LogicBlocks which will affected this character")] [Tooltip("List of LogicBlocks which will affected this character")]
protected List<LogicBlock> LogicChain; protected List<LogicBlock> LogicChain;
@ -41,9 +38,9 @@ public class BlockReader : MonoBehaviour
/// <summary> /// <summary>
/// Reads the current block in the logic chain /// Reads the current block in the logic chain
/// </summary> /// </summary>
/// <param name="character">Character to control</param>
/// <returns>Returns false if other readers should wait for this one to run again</returns> /// <returns>Returns false if other readers should wait for this one to run again</returns>
[ContextMenu("Do Read")]
public bool Read()
public bool Read(Character character)
{ {
//return that this is done if no more blocks left in chain //return that this is done if no more blocks left in chain
if (LogicChain.Count <= currentBlockIndex) if (LogicChain.Count <= currentBlockIndex)

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

@ -2,14 +2,45 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
[CreateAssetMenu(menuName = "Major Project/Combined Block")]
public class CombinedBlock : LogicBlock public class CombinedBlock : LogicBlock
{ {
#region Inspector Variables
[SerializeField] [SerializeField]
protected List<LogicBlock> SubBlocks ;
[Tooltip("Blocks this will run through")]
protected BlockReader blockReader;
#endregion Inspector Variables
#region Private Variables
#endregion Private Variables
public override bool Run(Character player)
{
BlockLogic(player);
if (blockReader.Finished)
{
blockReader.Reset();
RepeatCount++;
}
return isFinished();
}
protected override void BlockLogic(Character player) protected override void BlockLogic(Character player)
{ {
throw new System.NotImplementedException();
blockReader.Read(player);
}
/// <summary>
/// Resets the block to be ready to used again
/// </summary>
public override void Reset()
{
base.Reset();
blockReader.Reset();
} }
} }

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

@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Logic block which deals with jumping a character in a direction
/// </summary>
[CreateAssetMenu(menuName = "Major Project/Jump Block")]
public class Jump : LogicBlock
{
[SerializeField]
[Tooltip("Direction to Jump")]
protected Direction direction = Direction.Forward;
#region Class Functions
/// <summary>
/// Implementation of BlockLogic, moves the player forward
/// </summary>
/// <param name="player">Player to move</param>
protected override void BlockLogic(Character player)
{
player.Jump(direction);
}
#endregion Class Functions
}

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

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

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

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

+ 5
- 1
Packages/manifest.json View File

@ -7,6 +7,7 @@
"com.unity.purchasing": "2.0.3", "com.unity.purchasing": "2.0.3",
"com.unity.textmeshpro": "1.3.0", "com.unity.textmeshpro": "1.3.0",
"com.unity.modules.ai": "1.0.0", "com.unity.modules.ai": "1.0.0",
"com.unity.progrids": "3.0.0",
"com.unity.modules.animation": "1.0.0", "com.unity.modules.animation": "1.0.0",
"com.unity.modules.assetbundle": "1.0.0", "com.unity.modules.assetbundle": "1.0.0",
"com.unity.modules.audio": "1.0.0", "com.unity.modules.audio": "1.0.0",
@ -36,5 +37,8 @@
"com.unity.modules.vr": "1.0.0", "com.unity.modules.vr": "1.0.0",
"com.unity.modules.wind": "1.0.0", "com.unity.modules.wind": "1.0.0",
"com.unity.modules.xr": "1.0.0" "com.unity.modules.xr": "1.0.0"
}
},
"registry":"http://staging-packages.unity.com"
} }

Loading…
Cancel
Save