Пример #1
0
    IEnumerator HoldObject()
    {
        //holdObject = HoldObject();
        float distance;

        do
        {
            distance = Vector2.Distance(transform.position, currentObject.transform.position);
            yield return(new WaitForFixedUpdate());
        } while (!MathHelper.IsFloatBetween(distance, 0.1f, 0f));
        SnapObject.SnapTheObject(currentObject);
        currentObject.GetComponent <Rigidbody>().isKinematic = true;
        //holdObject = null;
    }
Пример #2
0
 public void setLetter(string name, KeyCode keycode)
 {
     if (showNumber )
     {
         if (letterSnaped == null)
         {
             GameObject letterGO = GameObject.Instantiate(letterPrefab, Vector3.zero, letterPrefab.transform.rotation) as GameObject;
             letterSnaped = letterGO.GetComponent<SnapObject>();
             letterSnaped.oToSnap = this.transform;
         }
         TextMesh letterMesh = letterSnaped.GetComponent<TextMesh>();
         if (keycode != null && letterMesh != null)
             letterMesh.text = name;
     }
     _letter = keycode;
 }
Пример #3
0
    void Update()
    {
        if (laser.isHit())
        {
            snapObjScript = laser.getHitObject().GetComponent <SnapObject>();
        }
        else
        {
            snapObjScript = null;
        }



        if (snapObjScript != null && snapObjScript.isSnap())
        {
            laser.setSnapPoint(snapObjScript.getSnapPt(laser.getHitPoint()));
        }
        else
        {
            laser.clearSnappedPoint();
        }



        // highlight object being edited if edit mode is on or the pointed object
        hitAppObj = GeneralSettings.editOn() ? GeneralSettings.getEditObject() : GeneralSettings.getParentClone(laser.getHitObject(), "app_");
        if (hitAppObj != null)
        {
            hitAppObj.GetComponent <Highlightable>().highlightObject();
        }


        // actions in selection mode
        if (am == null)
        {
            selActionMethods();
            return;
        }


        am.amUpdate(laser);
        cm.cmUpdate(laser);
    }
Пример #4
0
    public void AlignBlocks()
    {
        for (int i = 0; i < Blocks.Length; i++)
        {
            Vector3 newPosition = Blocks[i].GetComponentInParent <Transform>().position;

            newPosition.x = Mathf.Round(newPosition.x * 2f) * 0.5f;
            newPosition.y = Mathf.Round(newPosition.y * 2f) * 0.5f;

            if (SnapObject.IsThisInteger(newPosition.x))
            {
                // do stuff
                newPosition.x += 0.5f;
            }
            if (SnapObject.IsThisInteger(newPosition.y))
            {
                newPosition.y += 0.5f;
                //do stuff
            }

            Blocks[i].GetComponentInParent <Transform>().position = newPosition;
        }
    }
Пример #5
0
 void OnStartFall()
 {
     theTween.Pause();
     this.transform.localScale = startScale;
     SnapObject.SnapTheObject(this.transform);
 }
Пример #6
0
 void Awake()
 {
     snapObject = gameObject.GetComponent <SnapObject>();
     target     = GameObject.Find("ScriptHolder").GetComponent <ObjectToMousePosition>();
 }
Пример #7
0
        public SnapshotItem FindItem(int id, SnapObject type)
        {
            var key = (int)type << 16 | id;

            return(FindItem(key));
        }
Пример #8
0
 public static BaseSnapObject GetInstanceByType(SnapObject type)
 {
     return(_activators.ContainsKey(type)
         ? _activators[type]()
         : null);
 }
Пример #9
0
 public static int GetSizeByType(SnapObject type)
 {
     return(_typesSizes.ContainsKey(type)
         ? _typesSizes[type]
         : 0);
 }