protected override void Update() { for (int i = 0; i < CS_PlayerManager.Instance.GetTeamCount(); i++) { // Debug.Log (isPlayerWearing.Count); if (isPlayerWearing [i] == true) { //increase myPlayerWearingTime [i] += Time.deltaTime; if (myPlayerWearingTime [i] > myWearTime) { myPlayerWearingTime [i] -= myWearTime; if (CheckGoal(i)) { //play particle //play sound ParticleSystem t_particle = PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.Score); if (myRuleInfo.isTeamBased) { t_particle.transform.position = myWears[i].transform.position; AiryAudioManager.Instance.GetAudioData("ScoreSounds").Play(myWears[i].transform.position); } else { t_particle.transform.position = myWears[0].transform.position; ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(i)); t_particle.Play(); AiryAudioManager.Instance.GetAudioData("ScoreSounds").Play(myWears[0].transform.position); } Goal(i); } } } else if (myPlayerWearingTime [i] > 0) { //drain myPlayerWearingTime [i] = 0; } //show the progress // myAreas [i].GetComponent<CS_Prop_Area> ().SetProgress (myPlayerOnHillTime [i] / myAreaTime); } }
protected override void Update() { for (int i = 0; i < CS_PlayerManager.Instance.GetTeamCount(); i++) { if (isActive [i] == true && isPlayerOnHill [i] > 0 && CheckGoal(i)) { //increase myPlayerOnHillTime [i] += Time.deltaTime; if (myPlayerOnHillTime [i] > myAreaTime) { myPlayerOnHillTime [i] -= myAreaTime; Goal(i); //play particle ParticleSystem t_particle = PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.Score); t_particle.transform.position = myAreas[i].transform.position; ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(i)); t_particle.Play(); //play sound AiryAudioManager.Instance.GetAudioData("ScoreSounds").Play(myAreas[i].transform.position); } } else if (myPlayerOnHillTime [i] > 0) { //drain myPlayerOnHillTime [i] -= Time.deltaTime * myAreaDrainSpeed; if (myPlayerOnHillTime [i] < 0) { myPlayerOnHillTime [i] = 0; } } //show the progress myAreas [i].SetProgress(myPlayerOnHillTime [i] / myAreaTime); } }
public override void Enter(GameObject g_ball, GameObject g_goal) { if (g_ball.name != myBallPrefab.name) { return; } int t_index = myGoals.IndexOf(g_goal); if (isActive [t_index] == false) { return; } if (CheckGoal(t_index)) { //play particle ParticleSystem t_particle = PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.Score); t_particle.transform.position = g_ball.transform.position; ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index)); t_particle.Play(); //play sound AiryAudioManager.Instance.GetAudioData("ScoreSounds").Play(g_goal.transform.position); Debug.Log("PLAYEED"); Destroy(g_ball); InitBall(); Goal(t_index); } }
public override void Enter(GameObject g_player, GameObject g_goal) { // Debug.Log ("Enter!"); CS_PlayerControl t_playerControl = g_player.GetComponent <CS_PlayerControl> (); if (t_playerControl == null) { return; } int t_index = CS_PlayerManager.Instance.GetIndexNumber(t_playerControl.GetTeam()); if (isActive [t_index] == false) { return; } if (myFlags [t_index].ContainsKey(g_goal)) { if (myFlags [t_index] [g_goal] == false) { //active flag //play particle ParticleSystem t_particle = PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.ScoreSub); t_particle.transform.position = g_goal.transform.position + new Vector3(0, 1.5f, 0); ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index)); t_particle.Play(); //change flag color g_goal.GetComponent <CS_Prop_Color> ().SetColor( CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index, true) ); //play sound AiryAudioManager.Instance.GetAudioData("ScoreSmallSounds").Play(g_goal.transform.position); myFlags [t_index] [g_goal] = true; Debug.Log("flag"); } } else if (g_goal == myGoal && CheckGoal(t_index)) { //check all touch bool t_allTouched = true; foreach (bool f_flagStatus in myFlags[t_index].Values) { if (f_flagStatus == false) { t_allTouched = false; break; } } if (t_allTouched) { //reset flags, using System.Linq; foreach (GameObject key in myFlags[t_index].Keys.ToList()) { myFlags [t_index] [key] = false; } //play particle ParticleSystem t_particle = PoppingParticlePoolManager.Instance.GetFromPool(Hang.PoppingParticlePool.ParticleType.Score); t_particle.transform.position = g_player.transform.position; ParticleActions.SetColor(t_particle, CS_PlayerManager.Instance.GetTeamColorFromIndex(t_index)); t_particle.Play(); //play sound AiryAudioManager.Instance.GetAudioData("ScoreSounds").Play(g_goal.transform.position); Debug.Log("PLAYEED"); Goal(t_index); } else { Debug.Log("Missing Flag"); } } }