Esempio n. 1
0
 public void removeLetter()
 {
     if (_letter != null)
     {
         Destroy(_letter.gameObject);
         _letter = null;
     }
 }
Esempio n. 2
0
 void OnPointerUp()
 {
     dragging = null;
     if (_letter != null)
     {
         _letter.OnPointerUp();
     }
 }
Esempio n. 3
0
        public void spawnLetteAtTube()
        {
            int           index = UnityEngine.Random.Range(0, allLetters.Count);
            LL_LetterData ld    = (LL_LetterData)allLetters[index];

            allLetters.RemoveAt(index);

            //check which tube to activate
            currentTube   = "ABCD".IndexOf(ld.Data.SoundZone);
            currentLetter = letterManager.spawnLetter(ld);
            currentLetter.MoveBy(new UnityEngine.Vector3(-11, 0, 0), 1.8f);
        }
Esempio n. 4
0
        public void IncrementRound()
        {
            currentLetter = null;
            ++currentRound;
            letterManager.removeLetter();

            if (currentRound > 6)
            {
                return;
            }


            roundText.text = "#" + currentRound.ToString();

            spawnLetteAtTube();
        }
Esempio n. 5
0
        void OnPointerDown()
        {
            if (_letter != null)
            {
                var pointerPosition = game.Context.GetInputManager().LastPointerPosition;
                var screenRay       = Camera.main.ScreenPointToRay(pointerPosition);

                RaycastHit hitInfo;
                if (_letter.GetComponent <Collider>().Raycast(screenRay, out hitInfo, Camera.main.farClipPlane))
                {
                    dragging = _letter;

                    _letter.OnPointerDown(pointerPosition);
                }
            }
        }
Esempio n. 6
0
        //uses fast crowd letter management and dragging:
        public TakeMeHomeLL spawnLetter(ILivingLetterData data)
        {
            //

            LetterObjectView letterObjectView = Instantiate(LLPrefab);

            letterObjectView.gameObject.SetActive(true);
            letterObjectView.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
            letterObjectView.transform.SetParent(transform, true);
            Vector3 newPosition = GetComponent <TakeMeHomeGame> ().LLSpawnPosition.position;           // = walkableArea.GetFurthestSpawn(letters); // Find isolated spawn point

            letterObjectView.transform.position = newPosition;
            //letterObjectView.transform.rotation = Quaternion.identity
            letterObjectView.Init(data);

            var ll = letterObjectView.gameObject.AddComponent <TakeMeHomeLL>();

            ll.Initialize(plane.transform.position.y, letterObjectView, GetComponent <TakeMeHomeGame> ().spawnTube.transform.position);

            /*/var livingLetter = letterObjectView.gameObject.AddComponent<FastCrowdLivingLetter>();
             * //livingLetter.crowd = this;
             *
             * letterObjectView.gameObject.AddComponent<FastCrowdDraggableLetter>();*/
            letterObjectView.gameObject.AddComponent <Rigidbody>().isKinematic = true;

            foreach (var collider in letterObjectView.gameObject.GetComponentsInChildren <Collider>())
            {
                collider.isTrigger = true;
            }

            var characterController = letterObjectView.gameObject.AddComponent <CharacterController>();

            characterController.height = 6;
            characterController.center = Vector3.up * 3;
            characterController.radius = 1.5f;



            _letter = (ll);

            return(ll);
        }