// static metod to adding whatever you want to static public void AddItem(Item item) { //Debug.Log("Item " + item + " ID " + item.itemID); switch (item.itemType) { case Item.eItemType.Heart: if (item.itemID == "00H1") { AddLife(item); } else { AddOrb(item); } break; case Item.eItemType.Armor: if (item.itemID == "00A1") { AddArmor(item); } break; case Item.eItemType.Cash: // Debug.Log("Added cash: " + item.value); Warpaid.AddCash(item.value); break; case Item.eItemType.Points: // Debug.Log("Added points: " + item.value); Warpaid.AddScore(item.value); TextEffect(item.value, item.transform); break; case Item.eItemType.Letter: AddLetter(item); // Notify the AchievementManager that something has happened AchievementManager.NotifyAchievementManager(item); break; case Item.eItemType.none: case Item.eItemType.all: Debug.LogWarning("Type of item has not been set!"); break; } HUDSystems.UpdateInventory(); }
static public void AddArmor(Item armor) { if (ARMORS == null) { ARMORS = new List <Item>(); } if (ARMORS.IndexOf(armor) == -1) { if (ARMORS.Count == 2) { Warpaid.AddScore(armor.value); TextEffect(armor.value, armor.transform); return; } ARMORS.Add(armor); S.armors = ARMORS.Count; } }
static public void AddLife(Item life) { if (LIFES == null) { LIFES = new List <Item>(); } if (LIFES.IndexOf(life) == -1) { if (LIFES.Count == 3) { Warpaid.AddScore(life.value); TextEffect(life.value, life.transform); return; } LIFES.Add(life); S.lifes = LIFES.Count; } }
void OnTriggerEnter(Collider coll) { if (immune) { return; } GameObject otherGO = coll.gameObject; if (otherGO.tag == "Bullet" || otherGO.transform.root.gameObject.tag == "Player") { if (otherGO.tag == "Bullet") { immune = true; // Destroy(otherGO); everyobjectdestroysitself Warpaid.InitDrop(dropProbability, transform); Warpaid.AddScore(score); } InstantiateParticleSystem(); Destroy(gameObject); } }
static public void AddLetter(Item letter) { bool addScore = false; switch (letter.itemID) { // snafu case "00LS": if (!snafuSystem.S) { snafuSystem.S = true; S.SnafuComplete(); } else { addScore = true; } break; case "00LN": if (!snafuSystem.N) { snafuSystem.N = true; S.SnafuComplete(); } else { addScore = true; } break; case "00LA": if (!snafuSystem.A) { snafuSystem.A = true; S.SnafuComplete(); } else { addScore = true; } break; case "00LF": if (!snafuSystem.F) { snafuSystem.F = true; S.SnafuComplete(); } else { addScore = true; } break; case "00LU": if (!snafuSystem.U) { snafuSystem.U = true; S.SnafuComplete(); } else { addScore = true; } break; // other letters, bullet time etc. case "00LR": if (S.freezeTime < 1f) { S.freezeTime += 0.1f; } else { S.freezeTime = 1f; addScore = true; } break; case "00LT": if (S.reflex < 1f) { S.reflex += 0.05f; } else { S.reflex = 1f; addScore = true; } break; case "00LB": if (S.bulletTime < 1f) { S.bulletTime += 0.05f; } else { S.bulletTime = 1f; addScore = true; } break; case "00LV": if (S.speedBoost < 1f) { S.speedBoost += 0.05f; } else { S.speedBoost = 1f; addScore = true; } break; case "00LE": if (S.energy < 1f) { S.energy += 0.2f; } else { S.energy = 1f; addScore = true; } //adding some energy ?/!? break; case "00L?": RandomEffect(); break; default: Debug.Log("Playership:AddLetter - ID of item has not been set"); break; } if (addScore) { Warpaid.AddScore(letter.value); TextEffect(letter.value, letter.transform); } }
// maybe one bool to change nor? static public void AddOrb(Item orb) { bool addScore = false; switch (orb.itemID) { // orbs case "00HA": if (!orbSystem.Red) { orbSystem.Red = true; } else { addScore = true; } break; case "00HB": if (!orbSystem.Orange) { orbSystem.Orange = true; } else { addScore = true; } break; case "00HC": if (!orbSystem.Yellow) { orbSystem.Yellow = true; } else { addScore = true; } break; case "00HD": if (!orbSystem.Green) { orbSystem.Green = true; } else { addScore = true; } break; case "00HE": if (!orbSystem.Blue) { orbSystem.Blue = true; } else { addScore = true; } break; case "00HF": if (!orbSystem.Purple) { orbSystem.Purple = true; } else { addScore = true; } break; case "00HG": if (!orbSystem.White) { orbSystem.White = true; } else { addScore = true; } break; default: Debug.Log("Playership:AddOrb - ID of item has not been set. ID: " + orb.itemID); break; } if (addScore) { Warpaid.AddScore(orb.value); TextEffect(orb.value, orb.transform); } }