Example #1
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);
        }
    }
Example #2
0
 void ColorTowers(Color color)
 {
     foreach (GameObject go in towers)
     {
         g.ColorGo(go, color);
     }
 }
Example #3
0
 void ConnectAssemblyCurrent()
 {
     g.ColorGo(goKeyHoleCurrent, Color.green);
     g.ColorGo(goKeyCurrent, Color.green);
     //
     g.RenameChild(goKeyCurrent, "Key", "KeyLocked");
     g.RenameChild(goKeyHoleCurrent, "KeyHole", "KeyHoleLocked");
     //
     goKeyCurrent.transform.parent = goKeyHoleCurrent.transform;
     //
     goKeyCurrent.transform.localPosition    = Vector3.zero;
     goKeyCurrent.transform.localEulerAngles = Vector3.zero;
     //
     g.assetMgr.SetAsset(goKeyHoleCurrent);
     //
     g.assetMgr.AddHelpers();
     //
     g.smoothMgr.LoadLastsAndTargets();
 }
Example #4
0
 void UpdateAttach()
 {
     if (ynTurn == true)
     {
         return;
     }
     UpdateAvailableNearBoltNut();
     if (goNutCurrent != null && goBoltCurrent != null)
     {
         Attach();
         g.ColorGo(goNutCurrent, Color.yellow);
         ynTurn    = true;
         cntTurn   = 0;
         deltaTilt = 4;
         float distY = goNutCurrent.transform.position.y - goBoltLocked.transform.position.y;
         deltaDistY = distY / cntTurnMax;
         g.numCompletedProgress++;
     }
 }
Example #5
0
    GameObject CreateLine(Vector3 posFrom, Vector3 posTo, float scaZ)
    {
        GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cylinder);

        go.transform.parent = g.goAssets.transform;
        RemoveCapsuleCollider(go);
        go.transform.localPosition = (posFrom + posTo) / 2;
        go.transform.LookAt(g.goGround.transform.TransformPoint(posTo));
        float dist = Vector3.Distance(posFrom, posTo);

        go.transform.Rotate(90, 0, 0);
        go.transform.localScale = new Vector3(scaZ, dist / 2, scaZ);
        g.ColorGo(go, ColorLine(scaZ));
        g.smoothMgr.LoadLastsAndTargets();
        //
        go.name = "Line_" + go.transform.parent.childCount + "_" + Time.realtimeSinceStartup;
        return(go);
    }