Add finishObjective
This commit is contained in:
parent
7603cd71e8
commit
44219c15b6
7 changed files with 211 additions and 23 deletions
125
Assets/Prefabs/Finish.prefab
Normal file
125
Assets/Prefabs/Finish.prefab
Normal file
|
@ -0,0 +1,125 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1001 &100100000
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 1
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications: []
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 0}
|
||||
m_RootGameObject: {fileID: 1432738936828138}
|
||||
m_IsPrefabParent: 1
|
||||
--- !u!1 &1432738936828138
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 4934141439166806}
|
||||
- component: {fileID: 61573315058613432}
|
||||
- component: {fileID: 114205155271538646}
|
||||
- component: {fileID: 212911672651431198}
|
||||
m_Layer: 0
|
||||
m_Name: Finish
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &4934141439166806
|
||||
Transform:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1432738936828138}
|
||||
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!61 &61573315058613432
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1432738936828138}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 1, y: 1}
|
||||
newSize: {x: 3, y: 1}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &114205155271538646
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1432738936828138}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ba8e1d7b878a1234390e852ac146280f, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!212 &212911672651431198
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 1
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 100100000}
|
||||
m_GameObject: {fileID: 1432738936828138}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RenderingLayerMask: 4294967295
|
||||
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: 1310459315
|
||||
m_SortingLayer: -1
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 21300000, guid: 10fdc6baf12d2f54b9679400cf4a723a, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 3, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
8
Assets/Prefabs/Finish.prefab.meta
Normal file
8
Assets/Prefabs/Finish.prefab.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 799dca5582eb03546b71ba32f493ec3b
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 100100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -2283,7 +2283,7 @@ MonoBehaviour:
|
|||
RockLUR: {fileID: 1938166751346222, guid: 6b83a6a46c57a634fa5085684bad0085, type: 2}
|
||||
RockURD: {fileID: 1437035058628240, guid: 30338afac8ce7054fbff8de89db815e8, type: 2}
|
||||
RockLRD: {fileID: 1251219893662246, guid: e37e0c5d4b013304cbcb32b223264452, type: 2}
|
||||
Flag: {fileID: 1065161683117842, guid: 06aa81f4fbf9a3a4a8f9fdadafcbf7fa, type: 2}
|
||||
Flag: {fileID: 1432738936828138, guid: 799dca5582eb03546b71ba32f493ec3b, type: 2}
|
||||
playerPrefab: {fileID: 1679161327080020, guid: 3d1911457c1e44f53b6b4044334db52f,
|
||||
type: 2}
|
||||
ui: {fileID: 1379476069}
|
||||
|
|
|
@ -229,15 +229,26 @@ public class GameController : MonoBehaviour {
|
|||
doorRootf.transform.SetParent(goFinish.transform);
|
||||
ltf = ltf.FindAll(x => x.tag == "door");
|
||||
finish = goFinish.AddComponent<Room>();
|
||||
|
||||
finish.SetCenter(dg.end.GetCenter());
|
||||
ltf.ForEach(x => {
|
||||
x.SetParent(doorRootf.transform);
|
||||
x.gameObject.GetComponent<Door>().SetParent(finish);
|
||||
});
|
||||
finish.SetDoorsRootObject(doorRootf);
|
||||
|
||||
// Spawnpoint
|
||||
GameObject fspawnpointRoot = new GameObject();
|
||||
fspawnpointRoot.name = "Spawnpoints";
|
||||
fspawnpointRoot.transform.SetParent(goStart.transform);
|
||||
fspawnpointRoot.transform.position = new Vector3(dg.end.roomPosition.x, dg.end.roomPosition.y, 0);
|
||||
GameObject fspawn = new GameObject();
|
||||
fspawn.transform.SetParent(fspawnpointRoot.transform);
|
||||
fspawn.transform.position = new Vector3(dg.end.GetCenter().x, dg.end.GetCenter().y, 0);
|
||||
finish.SetSpawnPointsRootObject(fspawnpointRoot);
|
||||
|
||||
finish.Reload();
|
||||
finish.transform.SetParent(mapRoot.transform);
|
||||
gp.CreateGOFromType(finish.GetCenter(), 0, Room.TileType.DOOR, GenerationProcessor.ExtendedTileType.Flag, goFinish);
|
||||
|
||||
// Other Rooms
|
||||
foreach (GenRoom gr in dg.rooms) {
|
||||
|
@ -295,9 +306,8 @@ public class GameController : MonoBehaviour {
|
|||
} else {
|
||||
Debug.Log("No Player spawned!");
|
||||
}
|
||||
|
||||
finish.SetObjective(new FinishObjective(finish));
|
||||
|
||||
FinishObjective fo = new FinishObjective(finish, genPrefabs[GenerationProcessor.ExtendedTileType.Flag]);
|
||||
finish.SetObjective(fo);
|
||||
}
|
||||
|
||||
private void Running() {
|
||||
|
|
|
@ -204,6 +204,7 @@ public class DungeonGenerator {
|
|||
}
|
||||
|
||||
start.spawnpoints.Add(start.GetCenter());
|
||||
end.spawnpoints.Add(end.GetCenter());
|
||||
|
||||
foreach (Vector2Int v in allDoors) {
|
||||
foreach (GenRoom r in rooms) {
|
||||
|
|
|
@ -2,20 +2,9 @@
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FinishObjective : Objective {
|
||||
public class FinishObjective : EntityObjective {
|
||||
|
||||
public FinishObjective(Room caller) : base(caller) { }
|
||||
|
||||
public override void ActivateGoal(Player player) {
|
||||
// Player reached the end => win
|
||||
base.ActivateGoal(player);
|
||||
UpdateGoal();
|
||||
}
|
||||
|
||||
public override void UpdateGoal() {
|
||||
if ((room.GetCenter() - (Vector2)player.transform.position).magnitude < 2)
|
||||
ReachedGoal();
|
||||
}
|
||||
public FinishObjective(Room caller, GameObject go) : base(caller, new List<GameObject> { go }) { }
|
||||
|
||||
protected override void ReachedGoal() {
|
||||
base.ReachedGoal();
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 10fdc6baf12d2f54b9679400cf4a723a
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
fileIDToRecycleName:
|
||||
21300000: finish
|
||||
2186277476908879412: ImportLogs
|
||||
externalObjects: {}
|
||||
serializedVersion: 5
|
||||
mipmaps:
|
||||
|
@ -38,12 +40,12 @@ TextureImporter:
|
|||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 1
|
||||
spriteMode: 2
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
spriteMeshType: 0
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spritePixelsToUnits: 2000
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
|
@ -67,9 +69,62 @@ TextureImporter:
|
|||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Standalone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
- serializedVersion: 2
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
sprites:
|
||||
- serializedVersion: 2
|
||||
name: finish
|
||||
rect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 2000
|
||||
height: 2000
|
||||
alignment: 0
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
outline: []
|
||||
physicsShape: []
|
||||
tessellationDetail: 0
|
||||
bones: []
|
||||
spriteID: 85de40b9c7d24fc4daf3bdc855f14327
|
||||
vertices: []
|
||||
indices:
|
||||
edges: []
|
||||
weights: []
|
||||
outline: []
|
||||
physicsShape: []
|
||||
bones: []
|
||||
|
|
Loading…
Add table
Reference in a new issue