예제 #1
0
 private void Awake()
 {
     _model = GetComponent <GarbageTankModel>();
     GetComponentInChildren <TrashTriggerView>().TrashTriggerEvent += TrashTrigger;
     Controller.TouchManager.TakeTrashEvent += TakeTrash;
     Controller.TouchManager.DropTrashEvent += DropTrash;
 }
예제 #2
0
        /// <summary>
        /// Counts on the fullness of all garbage tanks.
        /// Starts the logic of winning and finishing the game.
        /// </summary>
        /// <param name="model"></param>
        private void AddTrash(GarbageTankModel model)
        {
            AddTrashEvent.Invoke(model);
            var isAllFull = model.IsTrashFull;

            if (model.IsTrashFull)
            {
                foreach (var tempModel in _garbageTankArr)
                {
                    isAllFull &= tempModel.IsTrashFull;
                    if (!tempModel.IsTrashFull)
                    {
                        break;
                    }
                }
            }
            if (isAllFull)
            {
                StarParticle.Play();
                if (WinEvent != null)
                {
                    WinEvent.Invoke();
                }

                StartCoroutine(GameExit(StarParticle.main.duration));
            }
        }
예제 #3
0
 /// <summary>
 /// There is a sound of throwing out a certain type of trash.
 /// </summary>
 /// <param name="model">Garbage Tank Model.</param>
 private void AddTrash(GarbageTankModel model)
 {
     AudioSource.PlayClipAtPoint(Model.Audio.TrashClips.FirstOrDefault(
                                     color => color.Color == model.GarbageTankColor).Clip, model.Transform.position);
 }