Create basic Story classes and parameterize monsters in Battle scene

This commit is contained in:
henriquenakashima 2020-09-26 23:04:14 -04:00
parent 6181a7d50c
commit 0d7f4f4954
17 changed files with 268 additions and 48 deletions

8
Assets/Story/SceneId.cs Normal file
View file

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public enum SceneId
{
Chapter1_Cave,
}

View file

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

8
Assets/Story/Scenes.meta Normal file
View file

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

View file

@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Scene_Chapter1_Cave: StoryScene
{
public override IEnumerator Play() {
Debug.Log("OMG monsters!");
yield return new WaitForSeconds(2f);
BattleParameters battleParameters = BuildBattleGolemBats();
BattleSetup.StartBattle(battleParameters);
}
private BattleParameters BuildBattleGolemBats() {
BattleParameters battleParameters = new BattleParameters();
MonsterId[] monsterIds = new MonsterId[3] {
MonsterId.Golem,
MonsterId.Bat,
MonsterId.Bat,
};
MCardId[] mCardIds = new MCardId[10] {
MCardId.GraniteDefense,
MCardId.GraniteDefense,
MCardId.GolemCharge,
MCardId.GolemFist,
MCardId.VampireFangs,
MCardId.VampireFangs,
MCardId.Whirlwind,
MCardId.VampireFangs,
MCardId.VampireFangs,
MCardId.Whirlwind,
};
int[] mCardOwnerIndexes = new int[10] {
0, 0, 0, 0,
1, 1, 1,
2, 2, 2,
};
battleParameters.SetMonsters(monsterIds, mCardIds, mCardOwnerIndexes);
return battleParameters;
}
}

View file

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

View file

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StoryController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
// TODO: Read which scene should be loaded.
StoryScene scene = StorySceneDatabase.Load(SceneId.Chapter1_Cave);
StartCoroutine(scene.Play());
}
// Update is called once per frame
void Update()
{
}
}

View file

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

View file

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class StoryScene
{
public abstract IEnumerator Play();
}

View file

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

View file

@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StorySceneDatabase {
public static StoryScene Load(SceneId id) {
switch (id) {
case SceneId.Chapter1_Cave:
return new Scene_Chapter1_Cave();
default:
throw new System.NotImplementedException("StoryScene with id " + id + " missing.");
}
}
}

View file

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