Added drillable prefab to tilemap
6 files modified
2 files renamed
4 files added
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!1101 &-9087441188423582307 |
| | | AnimatorStateTransition: |
| | | m_ObjectHideFlags: 1 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_Name: |
| | | m_Conditions: |
| | | - m_ConditionMode: 1 |
| | | m_ConditionEvent: IsDrillingLeftRight |
| | | m_EventTreshold: 0 |
| | | m_DstStateMachine: {fileID: 0} |
| | | m_DstState: {fileID: -5387081852353806967} |
| | | m_Solo: 0 |
| | | m_Mute: 0 |
| | | m_IsExit: 0 |
| | | serializedVersion: 3 |
| | | m_TransitionDuration: 0 |
| | | m_TransitionOffset: 0 |
| | | m_ExitTime: 0.875 |
| | | m_HasExitTime: 0 |
| | | m_HasFixedDuration: 1 |
| | | m_InterruptionSource: 0 |
| | | m_OrderedInterruption: 1 |
| | | m_CanTransitionToSelf: 1 |
| | | --- !u!1101 &-8857883071945152901 |
| | | AnimatorStateTransition: |
| | | m_ObjectHideFlags: 1 |
| | |
| | | m_Position: {x: 620, y: 110, z: 0} |
| | | - serializedVersion: 1 |
| | | m_State: {fileID: 7984510369417086179} |
| | | m_Position: {x: 620, y: 200, z: 0} |
| | | m_Position: {x: 870, y: 200, z: 0} |
| | | - serializedVersion: 1 |
| | | m_State: {fileID: -8776216366201631375} |
| | | m_Position: {x: 620, y: 300, z: 0} |
| | |
| | | m_ChildStateMachines: |
| | | - serializedVersion: 1 |
| | | m_StateMachine: {fileID: -870871217648341797} |
| | | m_Position: {x: 470, y: -20, z: 0} |
| | | m_Position: {x: 620, y: -20, z: 0} |
| | | m_AnyStateTransitions: [] |
| | | m_EntryTransitions: [] |
| | | m_StateMachineTransitions: {} |
| | |
| | | m_AnyStatePosition: {x: 400, y: 310, z: 0} |
| | | m_EntryPosition: {x: 50, y: 120, z: 0} |
| | | m_ExitPosition: {x: 990, y: -40, z: 0} |
| | | m_ParentStateMachinePosition: {x: 830, y: 50, z: 0} |
| | | m_ParentStateMachinePosition: {x: 1070, y: 50, z: 0} |
| | | m_DefaultState: {fileID: 68305137226140118} |
| | | --- !u!1101 &-7913474699216770149 |
| | | AnimatorStateTransition: |
| | |
| | | playOnExit: 0 |
| | | playAfterDelay: 0 |
| | | playDelay: 0.25 |
| | | --- !u!1101 &-7054651801772689705 |
| | | AnimatorStateTransition: |
| | | m_ObjectHideFlags: 1 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_Name: |
| | | m_Conditions: |
| | | - m_ConditionMode: 1 |
| | | m_ConditionEvent: IsDrillingDown |
| | | m_EventTreshold: 0 |
| | | m_DstStateMachine: {fileID: 0} |
| | | m_DstState: {fileID: -7772001631268269027} |
| | | m_Solo: 0 |
| | | m_Mute: 0 |
| | | m_IsExit: 0 |
| | | serializedVersion: 3 |
| | | m_TransitionDuration: 0 |
| | | m_TransitionOffset: 0 |
| | | m_ExitTime: 0.875 |
| | | m_HasExitTime: 0 |
| | | m_HasFixedDuration: 1 |
| | | m_InterruptionSource: 0 |
| | | m_OrderedInterruption: 1 |
| | | m_CanTransitionToSelf: 1 |
| | | --- !u!1102 &-5387081852353806967 |
| | | AnimatorState: |
| | | serializedVersion: 6 |
| | |
| | | - {fileID: 1760657886866949958} |
| | | - {fileID: -8857883071945152901} |
| | | - {fileID: 3484489205103101802} |
| | | - {fileID: -9087441188423582307} |
| | | - {fileID: -7054651801772689705} |
| | | m_StateMachineBehaviours: [] |
| | | m_Position: {x: 50, y: 50, z: 0} |
| | | m_IKOnFeet: 0 |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | |
| | | public class Drillable : MonoBehaviour |
| | | { |
| | | public bool isDrillable = true; |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e273e4680f5bb884cad50c1fbda3d211 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public static UnityAction<GameObject, int> characterDamaged; |
| | | public static UnityAction<GameObject, int> characterHealed; |
| | | public static UnityAction<ContactPoint2D, DrillDirection> characterDrill; |
| | | public static UnityAction<Vector3> characterDrillingToPosition; |
| | | public static UnityAction<Vector3, DrillDirection> characterDrillingToPosition; |
| | | public static UnityAction characterDrillingToPositionAbort; |
| | | } |
File was renamed from Assets/GenerateTileMap.cs |
| | |
| | | private float offsetX; |
| | | private float offsetY; |
| | | Tilemap tilemap; |
| | | public RuleTile ruleTile; |
| | | public RuleTile forestRuleTile; |
| | | public TileBase borderTile; |
| | | //public List<TileBase> tiles; |
| | | |
| | | private void Awake() |
| | |
| | | { |
| | | if (!destroyedTiles.Contains(new Vector3Int(x, y, 0))) |
| | | { |
| | | tilemap.SetTile(new Vector3Int(x, y), ruleTile); |
| | | tilemap.SetTile(new Vector3Int(x, y), forestRuleTile); |
| | | } |
| | | } |
| | | |
| | |
| | | //Debug.Log(tilemap.HasTile(cellCoord)); |
| | | if (tilemap.HasTile(cellCoord)) |
| | | { |
| | | if (tilemap.GetInstantiatedObject(cellCoord)?.GetComponent<Drillable>()?.isDrillable ?? false) |
| | | { |
| | | tilemap.SetTile(cellCoord, null); |
| | | destroyedTiles.Add(cellCoord); |
| | | Vector3 moveToPosition = grid.CellToWorld(cellCoord); |
| | | moveToPosition.x += 0.5f; |
| | | moveToPosition.y += 0.5f; |
| | | CharacterEvents.characterDrillingToPosition.Invoke(moveToPosition); |
| | | CharacterEvents.characterDrillingToPosition.Invoke(moveToPosition, drillDirection); |
| | | } |
| | | else |
| | | { |
| | | //CharacterEvents.characterDrillingToPositionAbort.Invoke(moveToPosition); |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | private void OnEnable() |
| | | { |
| | | CharacterEvents.characterDrillingToPosition += (DrillingToPosition); |
| | | //CharacterEvents.characterDrillingToPositionAbort += (DrillingToPositionAbort); |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | CharacterEvents.characterDrillingToPosition -= (DrillingToPosition); |
| | | //CharacterEvents.characterDrillingToPositionAbort -= (DrillingToPositionAbort); |
| | | } |
| | | |
| | | private void Awake() |
| | |
| | | //Debug.Log(contactPoints[0].otherRigidbody?.gameObject.name); |
| | | if (contactPoints[0].otherRigidbody?.name == "Tilemap") |
| | | { |
| | | CharacterEvents.characterDrill.Invoke(contactPoints[0], drillDirection); |
| | | } |
| | | } |
| | | |
| | | private void DrillingToPosition(Vector3 tilePosition, DrillDirection drillDirection) |
| | | { |
| | | boxCollider.enabled = false; |
| | | switch (drillDirection) |
| | | { |
| | |
| | | Debug.Assert(false, "Add DrillDirection here!"); |
| | | break; |
| | | } |
| | | CharacterEvents.characterDrill.Invoke(contactPoints[0], drillDirection); |
| | | } |
| | | } |
| | | |
| | | private void DrillingToPosition(Vector3 tilePosition) |
| | | { |
| | | //Debug.Log("DrillingToPosition() called"); |
| | | //Debug.Log(gameObject.transform.position); |
| | | drillToPosition = true; |
| | |
| | | drillOriginalPosition = gameObject.transform.position; |
| | | //Debug.Log("drillOriginalPosition: " + drillOriginalPosition); |
| | | } |
| | | //private void DrillingToPositionAbort() |
| | | //{ |
| | | // IsDrilling = false; |
| | | // //Debug.Log("DrillingToPosition() called"); |
| | | // //Debug.Log(gameObject.transform.position); |
| | | // drillToPosition = false; |
| | | // //drillTilePosition = null; |
| | | // //Debug.Log("drillTilePosition: " + drillTilePosition); |
| | | // drillOriginalPosition = gameObject.transform.position; |
| | | // //Debug.Log("drillOriginalPosition: " + drillOriginalPosition); |
| | | //} |
| | | |
| | | //private void DrillLeftOrRight() |
| | | //{ |
New file |
| | |
| | | %YAML 1.1 |
| | | %TAG !u! tag:unity3d.com,2011: |
| | | --- !u!1 &3549545049718014148 |
| | | GameObject: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | serializedVersion: 6 |
| | | m_Component: |
| | | - component: {fileID: 8973229189939374991} |
| | | - component: {fileID: -776302461885629690} |
| | | m_Layer: 0 |
| | | m_Name: DrillForest (drillable) |
| | | m_TagString: Untagged |
| | | m_Icon: {fileID: 0} |
| | | m_NavMeshLayer: 0 |
| | | m_StaticEditorFlags: 0 |
| | | m_IsActive: 1 |
| | | --- !u!4 &8973229189939374991 |
| | | Transform: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148} |
| | | serializedVersion: 2 |
| | | 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_ConstrainProportionsScale: 0 |
| | | m_Children: [] |
| | | m_Father: {fileID: 0} |
| | | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} |
| | | --- !u!114 &-776302461885629690 |
| | | MonoBehaviour: |
| | | m_ObjectHideFlags: 0 |
| | | m_CorrespondingSourceObject: {fileID: 0} |
| | | m_PrefabInstance: {fileID: 0} |
| | | m_PrefabAsset: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148} |
| | | m_Enabled: 1 |
| | | m_EditorHideFlags: 0 |
| | | m_Script: {fileID: 11500000, guid: e273e4680f5bb884cad50c1fbda3d211, type: 3} |
| | | m_Name: |
| | | m_EditorClassIdentifier: |
| | | isDrillable: 1 |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c82bc431abdeded4ab41cfdd19459501 |
| | | PrefabImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | m_Name: ForestRuleTile |
| | | m_EditorClassIdentifier: |
| | | m_DefaultSprite: {fileID: -1554015212, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_DefaultGameObject: {fileID: 0} |
| | | m_DefaultGameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_DefaultColliderType: 1 |
| | | m_TilingRules: |
| | | - m_Id: 0 |
| | | m_Sprites: |
| | | - {fileID: -1200237691, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 1 |
| | | m_Sprites: |
| | | - {fileID: -1554015212, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 2 |
| | | m_Sprites: |
| | | - {fileID: 952801214, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 3 |
| | | m_Sprites: |
| | | - {fileID: -1701200628, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 4 |
| | | m_Sprites: |
| | | - {fileID: 1210147125, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 5 |
| | | m_Sprites: |
| | | - {fileID: -603009601, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 6 |
| | | m_Sprites: |
| | | - {fileID: -1438444955, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 7 |
| | | m_Sprites: |
| | | - {fileID: -1608621674, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | m_Sprites: |
| | | - {fileID: 68800321, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | - {fileID: 1862643484, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.703 |
| | |
| | | - m_Id: 9 |
| | | m_Sprites: |
| | | - {fileID: 1984530201, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 10 |
| | | m_Sprites: |
| | | - {fileID: -58827736, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 11 |
| | | m_Sprites: |
| | | - {fileID: 1943074245, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 13 |
| | | m_Sprites: |
| | | - {fileID: 956194596, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 16 |
| | | m_Sprites: |
| | | - {fileID: -855959738, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 14 |
| | | m_Sprites: |
| | | - {fileID: 1598334396, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | - m_Id: 15 |
| | | m_Sprites: |
| | | - {fileID: 1451081626, guid: 42962cf14c23fee4baaaea0cd52d52e0, type: 3} |
| | | m_GameObject: {fileID: 0} |
| | | m_GameObject: {fileID: 3549545049718014148, guid: c82bc431abdeded4ab41cfdd19459501, type: 3} |
| | | m_MinAnimationSpeed: 1 |
| | | m_MaxAnimationSpeed: 1 |
| | | m_PerlinScale: 0.5 |
| | |
| | | |
| | | |
| | | NEXT |
| | | Add drillable gameobject to tiles |
| | | Add borders to map |
| | | Add background to map |
| | | |