Ejemplo n.º 1
0
	// Update is called once per frame
	void Update () {
		if (captureProgress == captureRequirement)
		{
			ownedPlayer.AddElectricity(electricity);
			ownedPlayer.AddSteam(steam);
		}
		
		if (CheckForUnits() == true)
		{
			foreach (GameObject g in GetCollidingUnits())
			{
				if (captureProgress == 0)
				{
					ownedPlayer = (new cscript_unit = g).GetOwnedPlayer();
				}
				
				if ((new cscript_unit = g).GetOwnedPlayer() == ownedPlayer)
				{
					RaiseCaptureProgress(1);
				}
				else
				{
					LowerCaptureProgress(1);
				}
			}
Ejemplo n.º 2
0
	// Update is called once per frame
	void Update () {
		if (captureProgress == captureRequirement)
		{
			ownedPlayer.AddElectricity(electricity);
			ownedPlayer.AddSteam(steam);
		}
		
		if (CheckForUnits() == true)
		{
			foreach (GameObject g in GetCollidingUnits())
			{
				if (captureProgress == 0)
				{
					ownedPlayer = g.GetComponent<cscript_unit>().GetOwnedPlayer ();
				}
				
				if (g.GetComponent<cscript_unit>().GetOwnedPlayer () == ownedPlayer)
				{
					RaiseCaptureProgress(1);
				}
				else
				{
					LowerCaptureProgress(1);
				}
			}
		}
		
		if (captureProgress > 0 && captureProgress < captureRequirement)
		{
			captureProgress -= 1;
			
			if (captureProgress < 0)
				captureProgress = 0;
		}
		
		if (captureProgress == 0)
			ownedPlayer = null;
		
		if (captureProgress != 0)
		{
			//GUI.Label(Rect(Camera.main.WorldToViewportPoint (transform.position)), "Capture Progress: " + captureProgress + " / " + captureRequirement);
		}
		
		if (ownedPlayer == null)
			controlPointLight.color = Color.white;
		else if (ownedPlayer != GameObject.FindGameObjectWithTag("Master").GetComponent<cscript_master>().GetPlayer()  && captureProgress == captureRequirement)
			controlPointLight.color = Color.red;
		else if (captureProgress == captureRequirement)
			controlPointLight.color = Color.green;
	}
Ejemplo n.º 3
0
	// Update is called once per frame
	void Update () {
		if (captureProgress == captureRequirement)
		{
			ownedPlayer.AddElectricity(electricity);
			ownedPlayer.AddSteam(steam);
		}
		
		if (CheckForUnits() == true)
		{
			Debug.Log ("Unit Present!");
			
			foreach (GameObject g in GetCollidingUnits())
			{
				if (captureProgress == 0)
				{
					ownedPlayer = g.GetComponent<cscript_unit>().GetOwnedPlayer ();
				}
				
				if (g.GetComponent<cscript_unit>().GetOwnedPlayer () == ownedPlayer)
				{
					RaiseCaptureProgress(1);
				}
				else
				{
					LowerCaptureProgress(1);
				}
			}
		}
		
		if (captureProgress > 0 && captureProgress < captureRequirement)
		{
			captureProgress -= 1;
			
			if (captureProgress < 0)
				captureProgress = 0;
		}
		
		if (captureProgress == 0)
			ownedPlayer = null;
		
		if (captureProgress != 0)
		{
			//GUI.Label(Rect(Camera.main.WorldToViewportPoint (transform.position)), "Capture Progress: " + captureProgress + " / " + captureRequirement);
		}
	}
Ejemplo n.º 4
0
	public void ChangeOwnedPlayer(cscript_player p)
	{
		ownedPlayer = p;
	}