Ejemplo n.º 1
0
        private LaserBeam GetBeamFromPool()
        {
            foreach (var beam in beams)
            {
                if (beam.gameObject.activeInHierarchy == false)
                {
                    beam.gameObject.SetActive(true);
                    return(beam);
                }
            }

            LaserBeam newBeam = Instantiate(beamPrefab, transform).GetComponent <LaserBeam>();

            beams.Add(newBeam);
            return(newBeam);
        }
Ejemplo n.º 2
0
        private void CreateBeam(Vector3Int current, Vector3Int dir, MirrorAngle a = MirrorAngle.none)
        {
            LaserBeam beam = GetBeamFromPool();

            beam.transform.position = _navigation.CellToWorld(current);
            if (a != MirrorAngle.none)
            {
                beam.SetAngle(a);
            }
            else
            {
                beam.SetOrientation(dir);
            }


            //Force check to fix race-condition things.
            beam.ManualInitiate(puzzleManager);
        }