예제 #1
0
 private void HandleTutorial(AssemblyLineItem poppedItem, bool correct)       //TODO: Refactor this and HandleNormal into one clean method
 {
     lastPress = 0;
     if (multipleFinger != null)
     {
         StopCoroutine(multipleFinger);
         multipleFinger = null;
     }
     if (tutorialZone == 3)
     {
         finger.StopShake(GetCorrectTransform().position);
     }
     else
     {
         finger.StopShake(GetButtonTransform(tutorialZone).position);
     }
     if (correct)
     {
         assemblyLineController.PopFirstItem();
         poppedItem.Activate();
         assemblyLineController.MoveUpLine(false);
         if (assemblyLineController.LineComplete)
         {
             doctorMatchTutorial.Advance();
         }
         else if (tutorialZone == 3)
         {
             finger.transform.position = GetCorrectTransform().position;                //GetButtonTransform((int)assemblyLineController.PeekFirstItem().ItemType).transform.position;
         }
     }
     else
     {
         StartCoroutine(finger.Shake(new Vector3(0, 10), .25f));
     }
 }
예제 #2
0
    // Input coming from button scripts
    public void OnZoneClicked(DoctorMatchButtonTypes buttonType)
    {
        AssemblyLineItem peakedItem = assemblyLineController.PeekFirstItem();
        bool             correct    = peakedItem.ItemType == buttonType;
        float            comboMod   = comboController.ComboMod;

        if (correct)          //The same feedback is provided whether or not the game is in tutorial
        {
            StartCoroutine(particleController.SpawnFirework(comboMod, assemblyLineController.StartPosition.position));
            numOfCorrectDiagnose++;
            UpdateScore(2);
            ComboBonus();
            PlaySoundCorrect();
            comboController.IncrementCombo();
        }
        else
        {
            comboController.ResetCombo();
            UpdateScore(-1);
            BloodPanelManager.Instance.PlayBlood();
            AudioManager.Instance.PlayClip("minigameError");
        }

        if (isTutorial)          //But line movement and populating is different in each mode
        {
            HandleTutorial(peakedItem, correct);
        }
        else
        {
            HandleNormal(peakedItem);
        }
    }
예제 #3
0
 public void SpawnTutorialSet(int stage)
 {
     for (int i = 1; i < AssemblyLineItem.SPRITE_COUNT; i++)
     {
         GameObject item = GameObjectUtils.AddChild(itemParent, itemPrefab);
         item.transform.position = GetPosition(index: i, indexOffset: -1);            //StartPosition.position + (i - 1) * new Vector3(distanceBetween, 0);
         AssemblyLineItem newItemScript = item.GetComponent <AssemblyLineItem>();
         newItemScript.Init(i - 1, stage, i);
         itemQueue.Enqueue(newItemScript);
         newItemScript.CompareVisible(visibleCount, false);
     }
 }
예제 #4
0
    public void ShiftAndAddNewItem()
    {
        MoveUpLine();
        // Add new item
        GameObject item         = GameObjectUtils.AddChild(itemParent, itemPrefab);
        int        newItemIndex = itemQueue.Count;

        item.transform.position = GetPosition(index: newItemIndex);        //StartPosition.position + newItemIndex * new Vector3(distanceBetween, 0);
        AssemblyLineItem newItemScript = item.GetComponent <AssemblyLineItem>();

        newItemScript.Init(newItemIndex);
        itemQueue.Enqueue(newItemScript);
        newItemScript.CompareVisible(visibleCount, true);
    }
예제 #5
0
    public void PopulateQueue(bool compare = false, int count = -1, int indexOffset = 0)
    {
        UpdateVisibleCount();
        int toSpawn = (count == -1) ? startingCount + 1 : count;

        for (int i = 0; i < toSpawn; i++)
        {
            GameObject item = GameObjectUtils.AddChild(itemParent, itemPrefab);
            item.transform.position = GetPosition(index: i, indexOffset: indexOffset);
            AssemblyLineItem itemScript = item.GetComponent <AssemblyLineItem>();
            itemScript.Init((i + indexOffset));
            itemQueue.Enqueue(itemScript);
            itemScript.CompareVisible(visibleCount, compare);
        }
    }
예제 #6
0
    private void HandleNormal(AssemblyLineItem poppedItem)
    {
        assemblyLineController.PopFirstItem();
        poppedItem.Activate();
        int toClear = assemblyLineController.Count + bonusStack;

        lifeBarController.UpdateCount(toClear);
        if (!lifeBarController.IsEmpty || bonusStack > 0)
        {
            assemblyLineController.ShiftAndAddNewItem();
            if (lifeBarController.IsEmpty && bonusStack > 0)
            {
                bonusStack--;
            }
        }
        else if (!assemblyLineController.LineComplete)
        {
            assemblyLineController.MoveUpLine();
        }
        else
        {
            GameOver();
        }
    }
예제 #7
0
    private Transform GetCorrectTransform()
    {
        AssemblyLineItem item = assemblyLineController.PeekFirstItem();

        return(GetButtonTransform((int)item.ItemType - 1));
    }