Exemplo n.º 1
0
 IEnumerator PlayInitSounds()
 {
     foreach (KeyValuePair <Vector2Int, GameObject> rockTuple in rocks)
     {
         GameObject rock = rockTuple.Value;
         InteractableRockController controller = rock.GetComponent <InteractableRockController>();
         controller.playSlidingSfx();
         yield return(new WaitForSeconds(.05f));
     }
 }
Exemplo n.º 2
0
        public void OnDeselect(Transform t)
        {
            if (t.gameObject.tag == "Movable_Rock")
            {
                numPressed--;

                if (numPressed == 0)
                {
                    t.gameObject.GetComponent <InteractableRockController>().unselectRock();
                    controller = null;
                }
            }
        }
Exemplo n.º 3
0
        public void OnSelect(Transform t)
        {
            if (t.gameObject.tag == "Movable_Rock")
            {
                numPressed++;

                if (numPressed == 1)
                {
                    //t.gameObject.GetComponent<InteractableRockController>().selectRock();
                    controller = t.gameObject.GetComponent <InteractableRockController>();
                    StoreHandPositions();
                }
            }
        }
Exemplo n.º 4
0
    private void initRocks()
    {
        HashSet <Vector2Int> points = new HashSet <Vector2Int> ();

        while (points.Count < numRocks)
        {
            points.Add(new Vector2Int(Random.Range(0, rows), Random.Range(0, cols)));
        }
        foreach (Vector2Int point in points)
        {
            Vector3    pos  = getTransformPos(point);
            GameObject rock = Instantiate(rockTemplate, pos, Quaternion.identity, gameObject.transform);
            InteractableRockController control = rock.GetComponent <InteractableRockController> ();
            control.setManager(this);
            control.setPosition(point);
            rocks.Add(point, rock);
        }

        StartCoroutine(PlayInitSounds());
    }