예제 #1
0
 GameObject GetSpotNearToGo(GameObject go)
 {
     foreach (Transform tSpot in goSpots.transform)
     {
         if (g.IsNear(go, tSpot.gameObject, distNear) == true)
         {
             return(tSpot.gameObject);
         }
     }
     return(null);
 }
예제 #2
0
    void UpdateAvailableNearBoltNut()
    {
        goNutCurrent  = null;
        goBoltCurrent = null;
        List <GameObject> listPieces = g.assetMgr.GetListPieces();

        foreach (GameObject go in listPieces)
        {
            if (g.assetMgr.ContainsChildByName(go, "Bolt") == true)
            {
                foreach (GameObject goCheck in listPieces)
                {
                    if (go != goCheck)
                    {
                        if (g.assetMgr.ContainsChildByName(goCheck, "Nut") == true)
                        {
                            if (g.IsNear(go, goCheck, nearDist) == true)
                            {
                                goBoltCurrent = go;
                                goNutCurrent  = goCheck;
//                                Debug.Log("screw\n");
                                return;
                            }
                        }
                    }
                }
            }
        }
    }
예제 #3
0
    void UpdatePong()
    {
        bool yn = false;

        goAvoid = null;
        List <GameObject> gos = g.assetMgr.GetListPieces();

        foreach (GameObject go in gos)
        {
            if (g.assetMgr.IsPiece(go) == true)
            {
                if (go != goPuck)
                {
                    bool ynNear = false;
                    if (IsBorder(go) == true)
                    {
                        if (IsPuckNearBorder(go) == true)
                        {
                            ynNear = true;
                        }
                    }
                    else
                    {
                        if (g.IsNear(go, goPuck, nearDist * 1.5f) == true)
                        {
                            ynNear = true;
                        }
                    }
                    if (ynNear == true)
                    {
                        goAvoid = go;
                        yn      = true;
                        break;
                    }
                }
            }
        }
        if (yn == true)
        {
            g.ColorGo(goAvoid, (Color.green + Color.clear) / 2);
            if (IsBorder(goAvoid) == true)
            {
                AvoidBorder();
            }
            else
            {
                Avoid();
            }
            Invoke("ResetColors", .125f);
        }
    }
예제 #4
0
 GameObject FindNearTower(GameObject goCheck)
 {
     foreach (GameObject go in towers)
     {
         if (go != goCheck)
         {
             if (g.IsNear(go, goCheck, distNear) == true)
             {
                 return(go);
             }
         }
     }
     return(null);
 }
예제 #5
0
 void UpdateCamPlay()
 {
     ynNear = false;
     for (int n = 0; n < audioSources.Length; n++)
     {
         ynNear = g.IsNear(g.camMain.gameObject, goSources[n], distNear);
         if (ynNear == true && ynNearLast == false)
         {
             Play(audioSources[n], goSources[n]);
             g.autoMgr.ResetTimeLastTouch();
             SendNoiseRemote();
         }
     }
     ynNearLast = ynNear;
 }