Skip to content

Commit

Permalink
Flag Setting Event Component, Flag Check, Preview of Next Waves
Browse files Browse the repository at this point in the history
  • Loading branch information
WispyMouse committed Apr 13, 2022
1 parent 807fb97 commit aa50045
Show file tree
Hide file tree
Showing 38 changed files with 608 additions and 34 deletions.
41 changes: 38 additions & 3 deletions Assets/Battle/Battle.unity
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ GameObject:
- component: {fileID: 70238714}
- component: {fileID: 70238716}
- component: {fileID: 70238715}
- component: {fileID: 70238717}
m_Layer: 10
m_Name: Up Next
m_TagString: Untagged
Expand Down Expand Up @@ -357,6 +358,20 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 70238713}
m_CullTransparentMesh: 1
--- !u!114 &70238717
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 70238713}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8002c0ab94ebcb84cb57ce9a16118d15, type: 3}
m_Name:
m_EditorClassIdentifier:
PreviewRowParent: {fileID: 0}
RowPF: {fileID: 0}
--- !u!1001 &74218467
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -894,8 +909,13 @@ MonoBehaviour:
PlayerHealthHUDPosition: {fileID: 1346996721}
HudPF: {fileID: 422002143583290964, guid: fcc2d76a1cc8c9542922bfd94ed9701d, type: 3}
CommitButton: {fileID: 1208023376}
RetreatButton: {fileID: 692919498}
EncounterName: {fileID: 1458404741}
DefaultFoes: []
Preview: {fileID: 1938623423}
DefaultFoes:
- {fileID: 11400000, guid: 5105aa59977bf50478c93ae232d75338, type: 2}
- {fileID: 11400000, guid: d14f595b5163b404a9356bf2bde255d7, type: 2}
- {fileID: 11400000, guid: 65e5d93ec64375947b98055f79c02e1f, type: 2}
CommitButtonPressed:
m_PersistentCalls:
m_Calls: []
Expand Down Expand Up @@ -7256,6 +7276,7 @@ GameObject:
- component: {fileID: 1938623422}
- component: {fileID: 1938623421}
- component: {fileID: 1938623420}
- component: {fileID: 1938623423}
m_Layer: 10
m_Name: Panel
m_TagString: Untagged
Expand Down Expand Up @@ -7304,9 +7325,9 @@ MonoBehaviour:
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 0
m_ChildAlignment: 8
m_Spacing: 0
m_ChildForceExpandWidth: 1
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 1
m_ChildControlHeight: 1
Expand Down Expand Up @@ -7351,6 +7372,20 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1938623418}
m_CullTransparentMesh: 1
--- !u!114 &1938623423
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1938623418}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8002c0ab94ebcb84cb57ce9a16118d15, type: 3}
m_Name:
m_EditorClassIdentifier:
PreviewRowParent: {fileID: 1938623419}
RowPF: {fileID: 6185612918651403646, guid: 64769e1ad16c26543ace570f73c3341f, type: 3}
--- !u!4 &1953800179 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 8816518090911114164, guid: 2509665a9c7c0f0459eb0ef63b3b1613, type: 3}
Expand Down
2 changes: 2 additions & 0 deletions Assets/Battle/BattleSceneHelperTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class BattleSceneHelperTools : SceneHelperTools
public GameObject RetreatButton;
public TMP_Text EncounterName;

public IncomingPreview Preview;

public List<FoeBattleData> DefaultFoes;

public void EndBattle(bool isVictory = true)
Expand Down
3 changes: 3 additions & 0 deletions Assets/Battle/BattleState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public override IEnumerator Initialize()
PlayerPartyPointer.PartyMembers[ii].Hud = player;
}

ConsoleManager.Instance.Clear();

yield break;
}

Expand Down Expand Up @@ -171,6 +173,7 @@ public IEnumerator SpawnCurrentWaveAndContinueFight()
}

Opponents = curOpponents;
BattleSceneHelperToolsInstance.Preview.SetFromRemaining(Encounter.Foes.Skip(CurWave+1).ToList());
}

for (int ii = 0; ii < BattleSceneHelperToolsInstance.FoePositions.Length && ii < Opponents.OpposingMembers.Count; ii++)
Expand Down
2 changes: 1 addition & 1 deletion Assets/DCJam2022/Buttons/ButtonsSceneHelperTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ public void StartEvent(ObstacleEvent eventToStart)
}

Debug.Log($"Begin {eventToStart.ObstacleName}");
SceneHelperInstance.StartCoroutine(SceneHelper.GlobalStateMachineInstance.PushNewState(new HandleObstacleState(eventToStart)));
SceneHelperInstance.StartCoroutine(SceneHelper.GlobalStateMachineInstance.PushNewState(new HandleObstacleState(SceneHelperInstance, eventToStart)));
}
}
2 changes: 2 additions & 0 deletions Assets/DCJam2022/ChoiceHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

public class ChoiceHandler : MonoBehaviour
{
public SceneHelper SceneHelperInstance;

public Button ChoicePF;
public Transform ChoiceParent;
public TMP_Text DecisionText;
Expand Down
13 changes: 13 additions & 0 deletions Assets/DCJam2022/ChoiceState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ public IEnumerator StartState(GlobalStateMachine stateMachine, IGameplayState pr
Button newButton = GameObject.Instantiate(ChoiceHandlerInstance.ChoicePF, ChoiceHandlerInstance.ChoiceParent);
newButton.GetComponentInChildren<TMP_Text>().text = entry.ChoiceName;
newButton.onClick.AddListener(() => { ChoiceSelected(entryHolder); });

bool shouldShow = true;

foreach (FlagCheckCondition check in entry.FlagsRequired)
{
if (ChoiceHandlerInstance.SceneHelperInstance.SaveDataManagerInstance.CurrentSaveData.GetFlag(check.FlagToCheck) < check.RequiredMinValue)
{
shouldShow = false;
break;
}
}

newButton.interactable = shouldShow;
}

yield break;
Expand Down
5 changes: 5 additions & 0 deletions Assets/DCJam2022/ConsoleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ public void AddToLog(string toAdd)
{
LogText.text += $"\n{toAdd}";
}

public void Clear()
{
LogText.text = "";
}
}
23 changes: 23 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreview.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class IncomingPreview : MonoBehaviour
{
public Transform PreviewRowParent;
public IncomingPreviewRow RowPF;

public void SetFromRemaining(List<EncounterWave> WavesRemaining)
{
for (int ii = 0; ii < PreviewRowParent.childCount; ii++)
{
Destroy(PreviewRowParent.GetChild(ii).gameObject);
}

foreach (EncounterWave wave in WavesRemaining)
{
IncomingPreviewRow piece = Instantiate(RowPF, PreviewRowParent);
piece.SetFromRow(wave);
}
}
}
11 changes: 11 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreview.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreviewPiece.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class IncomingPreviewPiece : MonoBehaviour
{
public Image Graphic;
public void SetFromEncounterPhase(FoeEncounterPhase phase)
{
Graphic.sprite = phase.EncounteredFoe.AttackPhases[phase.FoeStartingPhase].AppearenceInPhase;
}
}
11 changes: 11 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreviewPiece.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

113 changes: 113 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreviewPiece.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7831970288420196701
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5268587258481041626}
- component: {fileID: 6974771781273813318}
- component: {fileID: 848225577996963513}
- component: {fileID: 8319950586273004899}
- component: {fileID: 5527548877253805060}
m_Layer: 10
m_Name: IncomingPreviewPiece
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5268587258481041626
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7831970288420196701}
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_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 40, y: 40}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6974771781273813318
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7831970288420196701}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ae5384db4eb4ce44a062759605ec690, type: 3}
m_Name:
m_EditorClassIdentifier:
Graphic: {fileID: 8319950586273004899}
--- !u!222 &848225577996963513
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7831970288420196701}
m_CullTransparentMesh: 1
--- !u!114 &8319950586273004899
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7831970288420196701}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &5527548877253805060
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7831970288420196701}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: 40
m_PreferredHeight: 40
m_FlexibleWidth: -1
m_FlexibleHeight: -1
m_LayoutPriority: 1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreviewRow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class IncomingPreviewRow : MonoBehaviour
{
public IncomingPreviewPiece PreviewPiecePF;

public Transform PieceParent;

public void SetFromRow(EncounterWave fromWave)
{
for (int ii = 0; ii < PieceParent.childCount; ii++)
{
Destroy(PieceParent.GetChild(ii).gameObject);
}

foreach (FoeEncounterPhase encounterPhase in fromWave.FoesInWave)
{
IncomingPreviewPiece piece = Instantiate(PreviewPiecePF, PieceParent);
piece.SetFromEncounterPhase(encounterPhase);
}
}
}
11 changes: 11 additions & 0 deletions Assets/DCJam2022/EncounterBattle/IncomingPreviewRow.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aa50045

Please sign in to comment.