示例#1
0
 public override void Interact()
 {
     Debug.Log("Interacting with the tree");
     for (int i = 0; i < players.Count; i++)
     {
         UnitBase u = players[i].GetComponent <unit>();
         if (u.GetType() == typeof(unit))
         {
             players[i].GetComponent <unit>().GatherResource(resource);
         }
     }
 }
示例#2
0
    void OnTriggerEnter(Collider collider)
    {
        if (collider.GetComponent <UnitBase>() == null)
        {
            return;
        }
        UnitBase pBase = collider.GetComponent <UnitBase> ();

        if (pBase != m_Unit)
        {
            if (pBase.GetType() == m_Unit.GetType())
            {
                return;
            }
        }

        pBase.GetDamage(m_Unit.GetAttackBase().nDmg);
        PooledThis();
    }
    void OnTriggerEnter(Collider collider)
    {
        UnitBase pBase = collider.GetComponent <UnitBase> ();

        if (pBase != null)
        {
            if (pBase.GetType() != m_Unit.GetType())
            {
                pBase.GetDamage(m_nValue);
                m_goEffect.SetActive(false);
                m_goEffect.SetActive(true);
                StopCoroutine(ExecuteCoroutine());
                Invoke("PooledThis", 0.5f);
                return;
            }
        }

        Panel pCol = collider.transform.GetComponent <Panel> ();

        if (pCol != null)
        {
            int nX = pCol.GetPoint().nX;
            int nZ = pCol.GetPoint().nZ;

            if (PhotonNetwork.room != null)
            {
                ChangePanelColor(pCol, nX, nZ);
            }
            else
            {
                ChangePanelColor(pCol);
            }
        }

        StopCoroutine(ExecuteCoroutine());
        Invoke("PooledThis", 0.25f);
    }
 public static void addToUnitList(UnitBase newUnit, int team)
 {
     if (team == 1)
     {
         newUnit.team = 1;
         newUnit.unit.layer = 10;
         if (newUnit.GetType() == typeof(Hero))
             hero1 = (Hero)newUnit;
     }
     else
     {
         newUnit.team = 2;
         newUnit.unit.layer = 11;
         if (newUnit.GetType() == typeof(Hero))
             hero2 = (Hero)newUnit;
     }
     //newUnit.unit.transform.FindChild("SelectCircle").gameObject.layer = newUnit.unit.layer;
     units.Add(newUnit);
 }