示例#1
0
    public void PassTurn()
    {
        activeUnits.Remove(activatedUnit);
        if (activatedUnit != null)
        {
            activatedUnit.movementLeft = 0;
        }
        activatedUnit = null;
        targetCircle.SetActive(false);
        targetCross.SetActive(false);
        confirmButton.gameObject.SetActive(false);
        chargeButton.gameObject.SetActive(false);

        if (activeUnits.Count <= 0)
        {
            activeUnits = new List <NetTBSUnit> (allActiveUnits);
        }

        foreach (NetTBSUnit u in allActiveUnits)
        {
            u.gameObject.GetComponent <Renderer> ().material = deactiveColor;
        }

        foreach (NetTBSUnit u in activeUnits)
        {
            u.gameObject.GetComponent <Renderer> ().material = activeColor;
            u.chargedDuringAction = false;
            u.movementLeft        = u.movementMax;
            u.destroyOldChargeArrows();
            if (!u.gameObject.activeInHierarchy)
            {
                activeUnits.Remove(u);
            }
        }
    }
示例#2
0
    IEnumerator chargePusher(Vector3 newPos)
    {
        RaycastHit hit;
        Vector3    chargDir = transform.position - newPos;

        while (moving)
        {
            Debug.DrawRay(transform.position, -chargDir.normalized * 1f, Color.blue);
            if (Physics.Raycast(transform.position, -chargDir.normalized, out hit, 1f))
            {
                if (hit.collider.tag == "Player")
                {
                    NetTBSUnit tmpUnit = hit.collider.GetComponent <NetTBSUnit> ();
                    if (tmpUnit.whoOwnsMe() != whoOwnsMe())
                    {
                        hit.collider.GetComponent <NetTBSUnit> ().Pushed(newPos, chargDir);
                    }
                }
                else if (hit.collider.tag == "Pushable")
                {
                    hit.collider.GetComponent <Pushable> ().Pushed(newPos, chargDir);
                }
            }
            yield return(null);
        }
    }
示例#3
0
    void UnitSelection(RaycastHit hit)
    {
        currentlySelectedUnit = hit.collider.gameObject.GetComponent <NetTBSUnit>();         //Set our current unit to the attempted selection

        if (currentlySelectedUnit.SelectUnit(playerNumber))
        {
            Debug.Log("Select this unit " + hit.collider.name.ToString());
        }
        else
        {
            Debug.Log("Unable to Select this unit " + hit.collider.name.ToString());
            currentlySelectedUnit = null;
        }
    }
示例#4
0
 public void RemoveDeadUnit(NetTBSUnit deadUnit)
 {
     allActiveUnits.Remove(deadUnit);
     activeUnits.Remove(deadUnit);
     checkIfWeLost();
 }
示例#5
0
 public void setChargeButton(NetTBSUnit caller, bool enabled)
 {
     chargeButton.gameObject.SetActive(enabled);
     chargeButton.onClick.RemoveAllListeners();
     chargeButton.onClick.AddListener(caller.displayChargeOptions);
 }
示例#6
0
 public void setConfirmButton(NetTBSUnit caller, bool enabled)
 {
     confirmButton.gameObject.SetActive(enabled);
     confirmButton.onClick.RemoveAllListeners();
     confirmButton.onClick.AddListener(caller.MoveUnitToConfirmedMovement);
 }