public Monster(int stage, MonsterRank newtype, GameManager gm){ maxHealth = baseHealth * Mathf.Pow (1.2f, stage); type = newtype; health = maxHealth; gameManager = gm; if (type == MonsterRank.MINIBOSS) maxHealth = health *= 1.2; else if (type == MonsterRank.BOSS) maxHealth = health *= 1.4; }
public MonsterRank GetNewMonsterType(MonsterRank killedMonster) { stageMonsterCounter++; if (killedMonster == MonsterRank.BOSS) { currentStage++; stageMonsterCounter = 1; Debug.Log ("Current stage : " + currentStage); } if (stageMonsterCounter <= 10) return MonsterRank.NORMAL; else if (stageMonsterCounter % 11 == 0) return MonsterRank.MINIBOSS; else if (stageMonsterCounter % 12 == 0) return MonsterRank.BOSS; else return MonsterRank.NORMAL; }
public void Save(Monster m) { health = m.health; maxHealth = m.maxHealth; type = m.type; }
public double GetGoldFromMonster (MonsterRank type, int stage) { if (type == MonsterRank.NORMAL) return Math.Round(1 * Mathf.Pow (1.1f, stage)); else if (type == MonsterRank.MINIBOSS) return Math.Round(1 * Mathf.Pow (1.1f, stage) * 1.5f); else return Math.Round(1 * Mathf.Pow (1.1f, stage) * 2f); }
void Update () { vetoDisplay.text = gold.ToString() + "\n" + stageManager.currentStage.ToString(); healthDisplay.text = monster.health.ToString("n0"); damageDisplay.text = tapDamage.ToString("n0") + " " + "damage"; monsterDisplay.text = stageManager.stageMonsterCounter.ToString() + " / 12"; healthBar.GetComponent<Image>().fillAmount = (float)(monster.health / monster.maxHealth); if (monster.type == MonsterRank.BOSS) { bossTimer -= Time.deltaTime; vetoDisplay.text += " " + bossTimer.ToString("F2"); if (bossTimer <= 0) { NewMonsterType = stageManager.FailedBoss(); monster = new Monster(stageManager.currentStage, NewMonsterType, this); } } if (monster.health <= 0) { GameObject tmp = CreateCoin(GetGoldFromMonster(monster.type, stageManager.currentStage)); tmp.transform.SetParent(canvas); goldcoins.Add(tmp); NewMonsterType = stageManager.GetNewMonsterType(monster.type); monster = new Monster(stageManager.currentStage, NewMonsterType, this); } }