Commit ca6aae62 authored by 김형모's avatar 김형모

Merge branch 'ProtoUI' into 'master'

Add enemy/godness manager



See merge request !3
parents 374763d2 4dde073a
Pipeline #221 skipped
......@@ -44,8 +44,8 @@ public class Enemy : MonoBehaviour {
void AttackGodness()
{
mainLogic.godnessHP -= Atk;
if (mainLogic.godnessHP <= 0)
mainLogic.godnessManager.godnessHP -= Atk;
if (mainLogic.godnessManager.godnessHP <= 0)
mainLogic.OnGodnessClicked();
}
}
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class EnemyManager : MonoBehaviour {
public int lastEnemyNum;
int maxEnemyNum;
public Slider enemySlider;
public Text lastEnemyNumText;
// Use this for initialization
void Start () {
maxEnemyNum = Data.EnemyNumber;
}
// Update is called once per frame
void FixedUpdate () {
enemySlider.value = (float)lastEnemyNum / maxEnemyNum;
lastEnemyNumText.text = lastEnemyNum + " / " + maxEnemyNum;
}
}
fileFormatVersion: 2
guid: 1a1690af196fb3546b0fb9950b06d434
timeCreated: 1454232706
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class GodnessManager : MonoBehaviour {
public int godnessHP;
int maxGodnessHP;
public Slider godnessSlider;
public Text godnessHPText;
// Use this for initialization
void Start () {
maxGodnessHP = Data.GodnessHP;
}
// Update is called once per frame
void FixedUpdate () {
godnessSlider.value = (float)godnessHP / maxGodnessHP;
godnessHPText.text = godnessHP + " / " + maxGodnessHP;
}
}
fileFormatVersion: 2
guid: b9fc51f35f222364ca421f62fa958ccc
timeCreated: 1454233827
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -9,25 +9,23 @@ public class MainLogic : MonoBehaviour {
public ClearUI ClearUI;
public SpaceUI SpaceUI;
public MoneyManager moneyManager;
public EnemyManager enemyManager;
public GodnessManager godnessManager;
public Enemy EnemyObject;
public Hole HoleObject;
public GameObject CreateButton;
public Button DestroyButton;
public Image NatureImage;
public Slider DestroySlider;
public Text GodnessHPText;
public Text lastEnemyNumText;
Hole[] holes = new Hole[9];
float nextSpwnrate;
int destroyCoolTime = 200;
int nowDestroyCoolTime = 200;
public int godnessHP;
int lastEnemyNum;
// Use this for initialization
void Start () {
DestroyButton.interactable = false;
godnessHP = Data.GodnessHP;
lastEnemyNum = Data.EnemyNumber;
godnessManager.godnessHP = Data.GodnessHP;
enemyManager.lastEnemyNum = Data.EnemyNumber;
nextSpwnrate = Data.startGen;
StartCoroutine(GameLogic());
}
......@@ -39,8 +37,6 @@ public class MainLogic : MonoBehaviour {
NatureImage.color = Color.yellow;
else
NatureImage.color = Color.red;
GodnessHPText.text = "X " + godnessHP;
lastEnemyNumText.text = "X " + lastEnemyNum;
if (nowDestroyCoolTime > 0)
{
nowDestroyCoolTime--;
......@@ -65,9 +61,9 @@ public class MainLogic : MonoBehaviour {
{
while (GameOverUI.gameObject.activeSelf == false)
{
if (lastEnemyNum > 0)
if (enemyManager.lastEnemyNum > 0)
{
lastEnemyNum--;
enemyManager.lastEnemyNum--;
int direction = Random.Range(0, 3);
Enemy nowEnemy;
if (direction == 0)
......
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment