public void DestroyAllGroup(ConstantManager.PointRatioType pointRatioType) { foreach (Transform group in this.objectGroups.transform) { if (group.gameObject.tag == "GroupParent") { ParentManager scriptParentManager = group.gameObject.GetComponent <ParentManager>(); ScoreManager.AddScoreToDestroyGroup(scriptParentManager.NumOfTargetChildren, pointRatioType); Destroy(group.gameObject); } else if (group.gameObject.tag == "ParentOfBullets") { foreach (Transform bullet in group.transform) { Destroy(bullet.gameObject); } } else if (group.gameObject.tag == "ParentOfTargets") { foreach (Transform target in group.transform) { Destroy(target.gameObject); } } } }
public static void AddScoreToDestroyGroup(int numOfTargetChildren, ConstantManager.PointRatioType pointRatioType) { int addend = 0; if (numOfTargetChildren >= 4) { addend = (int)ConstantManager.PointNumOfTarget.FourOrMore; } else if (numOfTargetChildren == 3) { addend = (int)ConstantManager.PointNumOfTarget.Three; } else if (numOfTargetChildren == 2) { addend = (int)ConstantManager.PointNumOfTarget.Two; } else if (numOfTargetChildren == 1) { addend = (int)ConstantManager.PointNumOfTarget.One; } addend *= (int)pointRatioType; AddWaveScore(GameDirector.CurrentWave, addend); if (ConstantManager.IsDebugMode) { Debug.Log("AddScoreToDestroyGroup addend:" + addend); Debug.Log("(TargetNum: " + numOfTargetChildren + " PointRatio:" + (int)pointRatioType + ")"); } }
public void Explosion(ConstantManager.PointRatioType pointRatioType) { int numOfChildren = this.NumOfBulletChildren + this.NumOfTargetChildren; if (ConstantManager.IsDebugMode) { Debug.Log("Explosion " + numOfChildren); } ScoreManager.AddScoreToDestroyGroup(this.NumOfTargetChildren, pointRatioType); Destroy(this.gameObject); }