/// <summary>
 /// Update method to determine the status of a player's launch from the charge ability.
 /// </summary>
 private void CheckLaunch()
 {
     if (player.GetButtonUp("Charge"))
     {
         rb2d.velocity   = new Vector2(vars.chargeSpeed * (SlingLeft() ? -1 : 1), vars.jumpForce);
         vars.isCharged  = false;
         vars.isLaunched = true;
         sfx.PlaySFX(8);
         UpdateAnimations("idle");
         vars.chargeTime = 0.3f;
     }
     else if (!vars.isLaunched)
     {
         rb2d.velocity = new Vector2(0, 0);
         if (vars.isFalling)
         {
             //ChangeState(State.CONTROL);
         }
     }
     else if (vars.isLaunched)
     {
         if (vars.chargeTime > 0)
         {
             vars.chargeTime -= Time.deltaTime;
         }
         else
         {
             if (vars.grounded || vars.wallSliding)
             {
                 ChangeState(State.CONTROL);
             }
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// General method to creating a clone
        /// </summary>
        /// <param name="cellType">Type of clone selected from clone UI</param>
        private void CreateClone(CellType cellType)
        {
            sfx.PlaySFX(1);

            GameObject toInstantiate;

            switch (cellType)
            {
            case CellType.M_FIGHTER:
                toInstantiate = melee_fighter;
                break;

            case CellType.R_FIGHTER:
                toInstantiate = ranged_fighter;
                break;

            case CellType.JUMPER:
                toInstantiate = jumper;
                break;

            case CellType.SLINGER:
                toInstantiate = slinger;
                break;

            case CellType.GROUND:
                toInstantiate = ground;
                break;

            case CellType.NORMAL:
            default:
                toInstantiate = normal;
                break;
            }

            CellController newCell = (Instantiate <GameObject>(toInstantiate, mainCell.vars.isOnGate ? mainCell.vars.gateLocation.position + Vector3.up : mainCell.gameObject.transform.position, Quaternion.identity)).GetComponent <CellController>();

            mainCell.vars.activeClones++;

            mainCell.vars.maxHealth -= 20;
            mainCell.vars.mainHealth = mainCell.vars.mainHealth > mainCell.vars.maxHealth ?
                                       mainCell.vars.maxHealth : mainCell.vars.mainHealth;

            index = 1;
            clones.Insert(index, newCell);

            currentActive.ChangeState(State.INACTIVE);
            SetActiveAndCam(newCell);
            currentActive.vars.type = cellType;
            GivePowerups();
            currentActive.vars.isClone = true;
            UIManager.uIManager.SyncClones();
        }
Esempio n. 3
0
        public bool DisplayNextSentence(DialogueTrigger dialogueTrigger)
        {
            if (!isTriggered || dialogueTrigger != currentDialogueTarget)
            {
                return(false);
            }
            sfx.PlaySFX(0);
            if (sentences.Count == 0)
            {
                EndDialogue();
                return(false);
            }

            if (textTyping != null)
            {
                StopCoroutine(textTyping);
                textTyping = null;
            }
            textTyping = StartCoroutine(TypeSentence(sentences.Dequeue()));
            return(true);
        }
Esempio n. 4
0
        void ScanInput()
        {
            xr = player.GetButtonDown("Camera X");
            yu = player.GetButtonDown("Camera Y");
            xl = player.GetNegativeButtonDown("Camera X");
            yd = player.GetNegativeButtonDown("Camera Y");

            if (xr || xl)
            {
                newSelection = currentSelection + 3;
            }
            else if (yu || yd)
            {
                if (currentSelection == 0 || currentSelection == 3)
                {
                    newSelection = currentSelection + (yd ? +1 : +2);
                }
                else if (currentSelection == 2 || currentSelection == 5)
                {
                    newSelection = currentSelection + (yd ? -2 : -1);
                }
                else
                {
                    newSelection = currentSelection + (yd ? +1 : -1);
                }
            }
            newSelection %= 6;

            if (newSelection != currentSelection)
            {
                CloneMenuBox oldSelect = cloneBoxes[currentSelection];
                CloneMenuBox newSelect = cloneBoxes[newSelection];
                currentSelection = newSelection;

                selectionOutline.transform.DOLocalMove(newSelect.transform.localPosition, 0.15f);
                sfxPlayer.PlaySFX(0, 1, 1);

                newSelect.SelectActive();
                oldSelect.DeselectActive();
            }
        }
Esempio n. 5
0
 private void TriggerButton(bool up)
 {
     sfxPlayer.PlaySFX(0, 0.6f, 1.2f);
     buttons[index].Highlight(false);
     if (!up)
     {
         index++;
         if (index >= buttons.Length)
         {
             index = 0;
         }
     }
     else
     {
         index--;
         if (index < 0)
         {
             index = buttons.Length - 1;
         }
     }
     buttons[index].Highlight(true);
 }