public Skeleton CreateSkeleton(GameObject prefab, Vector2 pos, float HP, float Atk, float Def, float AmountOfStatToGive, TypeOfStatIncrease Type) { GameObject skeleton = Instantiate(prefab, pos, Quaternion.identity) as GameObject; Skeleton skeleton_Clone = skeleton.GetComponent<Skeleton>(); skeleton_Clone.Initialize(HP, Atk, Def, AmountOfStatToGive, Type); return skeleton_Clone; }
public Bush CreateBush(GameObject prefab, Vector2 pos, float HP, float Atk, float Def, float AmountOfStatToGive, TypeOfStatIncrease type) { GameObject bush = Instantiate(prefab, pos, Quaternion.identity) as GameObject; Bush bush_Clone = bush.GetComponent<Bush>(); bush_Clone.Initialize(HP, pos, Atk, Def, AmountOfStatToGive, type); return bush_Clone; }
// Skeleton Instance public void Initialize(float HP, float Atk, float Def, float amountToStatToGive, TypeOfStatIncrease stat) { float multiplier = UnityEngine.Random.Range(-.1f, .1f); this.HP = HP + (HP * multiplier); this.Atk = Atk + (Atk * multiplier); this.Def = Def + (Def * multiplier); numberOfSoliders += 1; amountOfStatToGiveAponDeath = amountToStatToGive; typeOfStatIncrease = stat; }
// Skeleton Instance public void Initialize(float HP, Vector3 pos, float Atk, float Def, float amountToStatToGive, TypeOfStatIncrease stat) { float multiplier = UnityEngine.Random.Range(-.1f, .3f); this.HP = HP; this.Atk = Atk; this.Def = Def; transform.position = pos; amountOfStatToGiveAponDeath = amountToStatToGive; typeOfStatIncrease = stat; }
// Skeleton Instance public void Initialize(float HP, float Atk, float Def, float amountToStatToGive, TypeOfStatIncrease stat) { float multiplier = UnityEngine.Random.Range(-.1f, .3f); this.HP = HP + (HP * multiplier); this.Atk = Atk + (Atk * multiplier); this.Def = Def + (Def * multiplier); if(GameInfo.AreaToTeleportTo == GameInfo.Area.TutorialArea) numberOfTutorialSkeletons += 1; amountOfStatToGiveAponDeath = amountToStatToGive; typeOfStatIncrease = stat; }
// Skeleton Instance public void Initialize(float HP, float Atk, float Def, float amountToStatToGive, TypeOfStatIncrease stat) { float multiplier = UnityEngine.Random.Range(-.1f, .3f); this.HP = HP + (HP * multiplier); this.Atk = Atk + (Atk * multiplier); this.Def = Def + (Def * multiplier); if(GameInfo.AreaToTeleportTo == GameInfo.Area.TutorialArea) numberOfTutorialSkeletons += 1; if (GameInfo.AreaToTeleportTo == GameInfo.Area.Castle) numberOfCastleSkeletons += 1; amountOfStatToGiveAponDeath = amountToStatToGive; typeOfStatIncrease = stat; //Debug.Log("Skeleton Stats: "+transform.position+" HP=" + HP + " Atk=" + Atk + " Def=" + Def + " StatAmount=" + amountToStatToGive); }
// Killed enemy, increase stat public void IncreaseStat(float amount, TypeOfStatIncrease stat) { if(wellBeing == WellBeingState.Alive) { switch (stat) { case TypeOfStatIncrease.HP: maxHP = maxHP + amount >= HP_Cap ? HP_Cap : maxHP + amount; GameObject obj1 = Instantiate(hpStatUp) as GameObject; obj1.transform.SetParent(transform); obj1.transform.localPosition = new Vector3(0, 0); obj1.transform.localScale = new Vector3(1f, 1f, 1f); obj1.gameObject.SetActive(true); break; case TypeOfStatIncrease.ATK: Atk += amount; GameObject obj2 = Instantiate(atkStatUp) as GameObject; obj2.transform.SetParent(transform); obj2.transform.localPosition = new Vector3(0, 0); obj2.transform.localScale = new Vector3(1f, 1f, 1f); obj2.gameObject.SetActive(true); break; case TypeOfStatIncrease.DEF: Def = Def + amount >= DEF_Cap ? 0.5f : Def + amount; GameObject obj3 = Instantiate(defStatUp) as GameObject; obj3.transform.SetParent(transform); obj3.transform.localPosition = new Vector3(0, 0); obj3.transform.localScale = new Vector3(1f, 1f, 1f); obj3.gameObject.SetActive(true); break; } } }
//public static List<DeadEnemy> deadEnemyList; // Apon death give stats to player protected void GiveStatsToPlayerAponDeath(float amount, TypeOfStatIncrease stat) { //Debug.Log("Type: " + stat + " Amount: " + amount); Player player = FindObjectOfType<Player>(); player.IncreaseStat(amount, stat); }
// The weapon type sets the base then the scale is based on the y cooridinate (south to north, easy to harder) public void ScaleEnemyToWeaponType(float scale, TypeOfStatIncrease type) { if (playerCurrentWeapon != null) { TypeOfStatIncrease typeOfStat = type; switch (playerCurrentWeapon.weaponType) { case WeaponType.Wooden: // Wooden enemy stats HP_Median = 120f * scale; Atk_Median = 12f * scale; Def_Median = 0.01f * scale; switch (typeOfStat) { case TypeOfStatIncrease.ATK: AmountOfStatToGive = 0.5f; break; case TypeOfStatIncrease.DEF: AmountOfStatToGive = 0.0025f; break; case TypeOfStatIncrease.HP: AmountOfStatToGive = 1; break; } break; case WeaponType.Bronze: HP_Median = 1200 * scale; Atk_Median = 120 * scale; Def_Median = 0.03f * scale; switch (typeOfStat) { case TypeOfStatIncrease.ATK: AmountOfStatToGive = 1f * (scale - (scale / 3)); break; case TypeOfStatIncrease.DEF: AmountOfStatToGive = 0.005f; break; case TypeOfStatIncrease.HP: AmountOfStatToGive = 10 * (scale - (scale / 3)); break; } break; case WeaponType.Silver: case WeaponType.Gold: case WeaponType.Epic: HP_Median = 10000 * scale; Atk_Median = 1000 * scale; Def_Median = 0.1f * scale; switch (typeOfStat) { case TypeOfStatIncrease.ATK: AmountOfStatToGive = 50f * (scale - (scale / 3)); break; case TypeOfStatIncrease.DEF: AmountOfStatToGive = 0.005f; break; case TypeOfStatIncrease.HP: AmountOfStatToGive = 500f * (scale - (scale / 3)); break; } break; } } }
public void ScaleToYaxis(float y, TypeOfStatIncrease type) { if (y < 20f) // easy ScaleEnemyToWeaponType(1, type); else if (y > 20f && y < 80f) // moderate ScaleEnemyToWeaponType(2, type); else if (y > 80f && y < 170f) // hard ScaleEnemyToWeaponType(4, type); else if (y > 170f) ScaleEnemyToWeaponType(5, type); }
//public static List<DeadEnemy> deadEnemyList; // Apon death give stats to player protected void GiveStatsToPlayerAponDeath(float amount, TypeOfStatIncrease stat) { Player player = FindObjectOfType<Player>(); player.IncreaseStat(amount, stat); }