// 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); } }
// 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; }
// 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); } }
public void ChangeOwnedPlayer(cscript_player p) { ownedPlayer = p; }