1
Fork 0
mirror of https://github.com/Steffo99/octogem.git synced 2024-11-23 13:34:19 +00:00

Add a lot of new things.

This commit is contained in:
Steffo 2018-09-30 16:35:17 +02:00
parent 08b0ff61ef
commit ca09e6e55b
36 changed files with 803 additions and 65 deletions

View file

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

View file

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

View file

@ -0,0 +1,71 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!74 &7400000
AnimationClip:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Tile - Empty
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
m_UseHighQualityCurve: 1
m_RotationCurves: []
m_CompressedRotationCurves: []
m_EulerCurves: []
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 21300000, guid: 9f76c3183353ed64b9ebf509b7b85e23, type: 3}
- time: 1
value: {fileID: 21300000, guid: 9f76c3183353ed64b9ebf509b7b85e23, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 1
m_WrapMode: 0
m_Bounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
m_ClipBindingConstant:
genericBindings:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 21300000, guid: 9f76c3183353ed64b9ebf509b7b85e23, type: 3}
- {fileID: 21300000, guid: 9f76c3183353ed64b9ebf509b7b85e23, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 2
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
m_HasAdditiveReferencePose: 0
m_LoopTime: 0
m_LoopBlend: 0
m_LoopBlendOrientation: 0
m_LoopBlendPositionY: 0
m_LoopBlendPositionXZ: 0
m_KeepOriginalOrientation: 0
m_KeepOriginalPositionY: 1
m_KeepOriginalPositionXZ: 0
m_HeightFromFeet: 0
m_Mirror: 0
m_EditorCurves: []
m_EulerEditorCurves: []
m_HasGenericRootTransform: 0
m_HasMotionFloatCurves: 0
m_Events: []

View file

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

View file

@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Tile - Empty
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
m_StateMachine: {fileID: 1107819752203804064}
m_Mask: {fileID: 0}
m_Motions: []
m_Behaviours: []
m_BlendingMode: 0
m_SyncedLayerIndex: -1
m_DefaultWeight: 0
m_IKPass: 0
m_SyncedLayerAffectsTiming: 0
m_Controller: {fileID: 9100000}
--- !u!1102 &1102673661210870854
AnimatorState:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Tile - Empty
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 7400000, guid: a07d356f0e2b00d498ebd2fd927b89b9, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1107 &1107819752203804064
AnimatorStateMachine:
serializedVersion: 5
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Base Layer
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 1102673661210870854}
m_Position: {x: 252, y: 120, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
m_AnyStatePosition: {x: 48, y: 12, z: 0}
m_EntryPosition: {x: 50, y: 120, z: 0}
m_ExitPosition: {x: 800, y: 120, z: 0}
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
m_DefaultState: {fileID: 1102673661210870854}

View file

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

144
Assets/Prefabs/Tile.prefab Normal file
View file

@ -0,0 +1,144 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7619017590530320985
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7619017590530320980}
- component: {fileID: 7619017590530320981}
- component: {fileID: 7619017590530320982}
- component: {fileID: 7619017590530320983}
- component: {fileID: 7619017590530320984}
- component: {fileID: 7619017590530320979}
m_Layer: 0
m_Name: Tile
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7619017590530320980
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7619017590530320985}
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: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7619017590530320981
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7619017590530320985}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: be9caeb91c0b7e8448f35dfafbe6f51a, type: 3}
m_Name:
m_EditorClassIdentifier:
position: {fileID: 0}
renderer: {fileID: 0}
effectsOnStep: []
effectsOnMove: []
--- !u!114 &7619017590530320982
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7619017590530320985}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 13d8303dc2ecd614da29c49b4b79d474, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &7619017590530320983
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7619017590530320985}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 927aa69c74f0efa43a80cadac2d8b371, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!212 &7619017590530320984
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7619017590530320985}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 9f76c3183353ed64b9ebf509b7b85e23, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!95 &7619017590530320979
Animator:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7619017590530320985}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 0}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: fb736807cb8914443857921327590a1e
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

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

View file

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

View file

@ -0,0 +1,97 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5086346472806276588
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3370354881353811389}
- component: {fileID: 4957439257958150607}
- component: {fileID: 9023318456491135986}
m_Layer: 0
m_Name: Empty
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &3370354881353811389
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5086346472806276588}
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: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4957439257958150607
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5086346472806276588}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a2758c3b99919494f89c8aba72aaabd2, type: 3}
m_Name:
m_EditorClassIdentifier:
AnimatorController: {fileID: 9100000, guid: cb0ee6e6fa48914439a1701f8d8b6b82, type: 2}
effectsOnStep: []
effectsOnMove: []
--- !u!212 &9023318456491135986
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5086346472806276588}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
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: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 21300000, guid: 9f76c3183353ed64b9ebf509b7b85e23, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 043f463a886d905498504a3184516ca7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -112,6 +112,96 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &212884740
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 212884742}
- component: {fileID: 212884741}
m_Layer: 0
m_Name: Map
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &212884741
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 212884740}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 84fff657861a75946a16f99d3c403f3e, type: 3}
m_Name:
m_EditorClassIdentifier:
mapSize: {x: 9, y: 7}
--- !u!4 &212884742
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 212884740}
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: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1623273643
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1623273644}
- component: {fileID: 1623273645}
m_Layer: 0
m_Name: Game Manager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1623273644
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1623273643}
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: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1623273645
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1623273643}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b43ae906445aac94c9f5559f01cb8096, type: 3}
m_Name:
m_EditorClassIdentifier:
baseTile: {fileID: 7619017590530320985, guid: fb736807cb8914443857921327590a1e, type: 3}
editorTileTypes:
- {fileID: 4957439257958150607, guid: 043f463a886d905498504a3184516ca7, type: 3}
--- !u!1 &1913437418
GameObject:
m_ObjectHideFlags: 0
@ -123,7 +213,6 @@ GameObject:
- component: {fileID: 1913437421}
- component: {fileID: 1913437420}
- component: {fileID: 1913437419}
- component: {fileID: 1913437422}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -165,7 +254,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 5
orthographic size: 3.708333
m_Depth: -1
m_CullingMask:
serializedVersion: 2
@ -189,21 +278,9 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1913437418}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalPosition: {x: 4, y: 3, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1913437422
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1913437418}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5c70939c05fbc95418c49f5866348963, type: 3}
m_Name:
m_EditorClassIdentifier:

View file

@ -0,0 +1,24 @@
using UnityEngine;
using System.Collections.Generic;
class BaseObjects : MonoBehaviour
{
public GameObject baseTile;
public List<TileType> editorTileTypes;
public Dictionary<string, TileType> tileTypes;
private void Awake()
{
//Fill the tileTypes dictionary
tileTypes = new Dictionary<string, TileType>();
foreach(TileType tileType in editorTileTypes)
{
if(tileType == null)
{
continue;
}
tileTypes.Add(tileType.name, tileType);
}
}
}

View file

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b43ae906445aac94c9f5559f01cb8096
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- baseTile: {fileID: 7619017590530320985, guid: fb736807cb8914443857921327590a1e, type: 3}
executionOrder: -100
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections.Generic;
public class Map : MonoBehaviour
{
public Vector2Int mapSize;
public Tile[,] tiles;
public List<Unit> units;
private BaseObjects bases;
private void Awake()
{
bases = FindObjectOfType<BaseObjects>();
//Create the tiles
tiles = new Tile[mapSize.x, mapSize.y];
for(int y = 0; y < mapSize.y; y++)
{
for(int x = 0; x < mapSize.x; x++)
{
GameObject currentTileObject = Instantiate(bases.baseTile, transform);
Tile currentTile = currentTileObject.GetComponent<Tile>();
tiles[x, y] = currentTile;
currentTile.transform.position = new Vector3(x, y);
currentTile.position.Position = new MapPosition(x, y);
currentTile.Type = bases.tileTypes["Empty"];
//TODO: tilerenderer
}
}
}
}

View file

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f4de78bceca8c4e4e9796028585062f3
guid: 84fff657861a75946a16f99d3c403f3e
MonoImporter:
externalObjects: {}
serializedVersion: 2

View file

@ -6,21 +6,21 @@ public override MapPosition Position
{
get
{
return Position;
return position;
}
set
{
position = value;
if (Debug.isDebugBuild)
{
//Check if the tile is in the expected position
Vector3 expectedPosition = new Vector3(Position.x + 0.5f, Position.y + 0.5f);
Vector3 expectedPosition = new Vector3(position.x + 0.5f, position.y + 0.5f);
if (transform.position != expectedPosition)
{
Debug.LogWarningFormat("{0}'s GemPosition is mismatched with its transform position.", gameObject.name);
}
}
Position = value;
}
}
}

View file

@ -2,5 +2,10 @@
public class GenericPosition : MonoBehaviour
{
public virtual MapPosition Position { get; set; }
protected MapPosition position;
public virtual MapPosition Position
{
get { return position; }
set { position = value; }
}
}

View file

@ -4,23 +4,20 @@ public class TilePosition : GenericPosition
{
public override MapPosition Position
{
get
{
return Position;
}
get { return position; }
set
{
position = value;
if (Debug.isDebugBuild)
{
//Check if the tile is in the expected position
Vector3 expectedPosition = new Vector3(Position.x, Position.y);
Vector3 expectedPosition = new Vector3(position.x, position.y);
if (transform.position != expectedPosition)
{
Debug.LogWarningFormat("{0}'s TilePosition is mismatched with its transform position.", gameObject.name);
}
}
Position = value;
}
}
}

View file

@ -3,14 +3,12 @@
public class UnitPosition : GenericPosition
{
public override MapPosition Position { get; set; }
void JumpTo(MapPosition position)
public void JumpTo(MapPosition position)
{
this.Position = position;
}
void StepTo(MapPosition position)
public void StepTo(MapPosition position)
{
if(!position.IsAdjacent(this.Position))
{

View file

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

View file

@ -0,0 +1,3 @@
public class GemRenderer : GenericRenderer
{
}

View file

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

View file

@ -0,0 +1,37 @@
using UnityEngine;
public class GenericRenderer : MonoBehaviour
{
private RuntimeAnimatorController animatorController;
private SpriteRenderer spriteRenderer;
private Animator animator;
public RuntimeAnimatorController AnimatorController
{
get
{
return animatorController;
}
set
{
animatorController = value;
animator.runtimeAnimatorController = value;
}
}
public virtual void Awake()
{
spriteRenderer = GetComponent<SpriteRenderer>();
animator = GetComponent<Animator>();
if (spriteRenderer == null)
{
Debug.LogError("Missing spriteRenderer on rendered GameObject");
}
if (animator == null)
{
Debug.LogError("Missiong animator on rendered GameObject");
}
}
}

View file

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

View file

@ -0,0 +1,3 @@
public class TileRenderer : GenericRenderer
{
}

View file

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

View file

@ -0,0 +1,44 @@
using System.Collections.Generic;
using UnityEngine;
public class Tile : MonoBehaviour
{
public TilePosition position;
public new TileRenderer renderer;
public List<GenericEffect> effectsOnStep;
public List<GenericEffect> effectsOnMove;
private TileType type;
void Awake()
{
position = GetComponent<TilePosition>();
renderer = GetComponent<TileRenderer>();
}
public TileType Type
{
get
{
return type;
}
set
{
type = value;
renderer.AnimatorController = type.AnimatorController;
effectsOnStep = type.effectsOnStep;
effectsOnMove = type.effectsOnMove;
}
}
public void SteppedOn(Unit walker)
{
effectsOnStep.ForEach(delegate (GenericEffect effect) { walker.ApplyNewEffect(effect); });
}
public void MovedOn(Unit walker)
{
effectsOnMove.ForEach(delegate (GenericEffect effect) { walker.ApplyNewEffect(effect); });
}
}

View file

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

View file

@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections.Generic;
public class TileType : MonoBehaviour
{
public RuntimeAnimatorController AnimatorController;
public List<GenericEffect> effectsOnStep;
public List<GenericEffect> effectsOnMove;
void Awake()
{
Debug.LogWarning("TileType components should never be awake.");
}
}

View file

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

View file

@ -4,12 +4,12 @@
public class Unit : MonoBehaviour
{
private UnitPosition position;
private UnitHealth health;
private UnitStats stats;
public UnitPosition position;
public UnitHealth health;
public UnitStats stats;
private List<GenericEffect> activeEffects;
void Start()
void Awake()
{
position = GetComponent<UnitPosition>();
health = GetComponent<UnitHealth>();
@ -26,7 +26,7 @@ public void Heal(int amount)
activeEffects.ForEach(delegate (GenericEffect effect) { effect.AfterHeal(this, amount); });
}
void Damage(int amount)
public void Damage(int amount)
{
activeEffects.ForEach(delegate (GenericEffect effect) { effect.BeforeDamage(this, amount); });
if (health != null)
@ -34,13 +34,13 @@ void Damage(int amount)
health.Damage(amount);
if (health.currentHealth == 0)
{
Die();
Kill();
}
}
activeEffects.ForEach(delegate (GenericEffect effect) { effect.AfterDamage(this, amount); });
}
void Die()
public void Kill()
{
bool deathPrevented = activeEffects.TrueForAll(delegate (GenericEffect effect) { return effect.BeforeDeath(this); });
if(deathPrevented)
@ -54,7 +54,13 @@ void Die()
//Die. For real.
}
void ApplyNewEffect(GenericEffect newEffect)
public void StepTo(MapPosition mapPosition)
{
position.StepTo(mapPosition);
//TODO
}
public void ApplyNewEffect(GenericEffect newEffect)
{
activeEffects.ForEach(delegate (GenericEffect existingEffect) { existingEffect.BeforeNewEffect(this, newEffect); });
activeEffects.Add(newEffect);

View file

@ -5,7 +5,7 @@ public class UnitHealth : MonoBehaviour
public int currentHealth;
public int maximumHealth = 10;
void Start()
void Awake()
{
currentHealth = maximumHealth;
}

View file

@ -1,22 +0,0 @@
using UnityEngine;
public class UnitRendering : MonoBehaviour
{
private SpriteRenderer spriteRenderer;
private Animator animator;
void Start()
{
spriteRenderer = GetComponent<SpriteRenderer>();
animator = GetComponent<Animator>();
if(spriteRenderer == null)
{
Debug.LogError("Missing spriteRenderer on rendered unit");
}
if(animator == null)
{
Debug.LogError("Missiong animator on rendered unit");
}
}
}

View file

@ -5,7 +5,7 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Scenes/SampleScene.unity
guid: 99c9720ab356a0642a771bea13969a05
- enabled: 0
path:
guid: 00000000000000000000000000000000
m_configObjects: {}