private void ChangeTarget() { if (CurrentVIP != null) { CurrentVIP.OwnerStats.IsVIP = false; } //Choose the next VIP. switch (ChooseNewTarget) { case NextTargetSelection.Random: CurrentVIP = GetRandomPossibleVIP(CurrentVIP); break; case NextTargetSelection.HighestScore: CurrentVIP = GetHighestScoringPossibleVIP(CurrentVIP); break; case NextTargetSelection.LowestScore: CurrentVIP = GetLowestScoringPossibleVIP(CurrentVIP); break; case NextTargetSelection.FewestTimesAsVIP: CurrentVIP = GetPossibleFewestTimesVIP(CurrentVIP); break; default: throw new NotImplementedException(); } //If there are no eligible VIP's, complain. if (CurrentVIP == null) { return;//throw new NoTargetsException(); } //Set the counters until the next VIP. timeTillChange = TimeAsTarget; totalPainDealtThreshold = CurrentVIP.OwnerStats.PainDealtAsVIP + DealtPainThresholdAsTarget; totalPainReceivedThreshold = CurrentVIP.OwnerStats.PainReceivedAsVIP + TakenPainThresholdAsTarget; //Set stats. if (Aura == null) { Aura = WorldConstants.Creator.CreateAura(CurrentVIP.transform).GetComponent <AuraBehavior>(); auraParticles = Aura.transform.GetChild(0).GetComponent <ParticleSystem>(); } auraParticles.enableEmission = false; Aura.transform.parent = CurrentVIP.transform; Aura.VIPChanged(); CurrentVIP.OwnerStats.IsVIP = true; CurrentVIP.OwnerStats.TimesAsVIP += 1; }
public GameObject CreateAura(Transform following) { GameObject g = (GameObject)Instantiate(AuraPrefab); g.name = "VIP Aura"; if (following != null) { g.transform.parent = following; } AuraBehavior ab = g.GetComponent <AuraBehavior>(); ab.VIPChanged(); GameObject g23 = CreateMinimapIcon(following.position, Animations.MM_Aura, null, MinimapIconScaling.Aura, MinimapIconZPoses.Aura); g23.transform.parent = g.transform; ab.ParticleEffects = CreateAuraParticles(g.transform); return(g); }