Ejemplo n.º 1
0
    /*
     * // In the Update event, the script checks if the cooldown timer has reached its
     * // end. If not, the cooldown timer is incremented by Time.deltaTime. Afterwards,
     * // the script checks for player input and calls a crew function if necessary.
     */

    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (cooldownTimer < cooldown)
        {
            cooldownTimer += Time.deltaTime;
        }

        if (InputWrapper.GetButtonDown(attackButton))
        {
            AttackCrew();
            DisplayUpdate();
        }

        else if (InputWrapper.GetButtonDown(defenseButton))
        {
            DefenseCrew();
            DisplayUpdate();
        }

        else if (InputWrapper.GetButtonDown(speedButton))
        {
            SpeedCrew();
            DisplayUpdate();
        }
    }
Ejemplo n.º 2
0
        public void Update()
        {
            Vector2 movement;
            // Gets information about input axis
            float inputX = InputWrapper.GetAxisRaw("Horizontal");
            float inputY = InputWrapper.GetAxisRaw("Vertical");

            // Prepare the movement for each direction
            movement = new Vector2(inputX, inputY);

            // Makes the movement relative to time
            movement *= Time.deltaTime;

            //get dodge input from player
            bool dodge = InputWrapper.GetButtonDown("Dodge");

            if (dodge)
            {
                player.StartDodge();
            }

            player.Walk(movement.normalized);

            //get targeting input from player
            bool target = InputWrapper.GetButtonDown("Target");

            if (target)
            {
                if (!player.inCombat)
                {
                    player.Interact();
                }
                else
                {
                    player.ToggleTarget();
                }
            }

            //get attack input from player
            bool atk = InputWrapper.GetButtonDown("Attack");

            if (atk)
            {
                player.Attack();
            }

            bool toggleItem = InputWrapper.GetButtonDown("Toggle item");

            if (toggleItem)
            {
                ToggleItem();
            }

            bool useItem = InputWrapper.GetButtonDown("Use item");

            if (useItem)
            {
                UseItem();
            }
        }
Ejemplo n.º 3
0
    /// <summary>
    /// In the Update event, the script checks if the cooldown timer has reached its
    /// end. If not, the cooldown timer is incremented by Time.deltaTime.
    /// Otherwise, the script checks for player input. If a crew button is selected,
    /// then the function StatUpdate is called to update the stat in relation to the
    /// number of crew members available. If any change does occur, the modification
    /// goes to the StatSystem.
    /// </summary>

    // Update is called once per frame
    void Update()
    {
        if (isLocalPlayer)
        {
            if (cooldownTimer < COOLDOWN_LIMIT)
            {
                cooldownTimer           += Time.deltaTime;
                cooldownImage.fillAmount = cooldownTimer / COOLDOWN_LIMIT;
            }

            else
            {
                if (InputWrapper.GetButtonDown(attackButton))
                {
                    statChange = StatUpdate(ref attackStage);

                    if (statChange != 0)
                    {
                        statSystem.AlterAttack(STAGE_MULTIPLIER * statChange);
                        cooldownTimer = 0;
                    }
                }

                else if (InputWrapper.GetButtonDown(defenseButton))
                {
                    statChange = StatUpdate(ref defenseStage);

                    if (statChange != 0)
                    {
                        statSystem.AlterDefense(STAGE_MULTIPLIER * statChange);
                        cooldownTimer = 0;
                    }
                }

                else if (InputWrapper.GetButtonDown(speedButton))
                {
                    statChange = StatUpdate(ref speedStage);

                    if (statChange != 0)
                    {
                        statSystem.AlterSpeed(STAGE_MULTIPLIER * statChange);
                        cooldownTimer = 0;
                    }
                }

                else if (InputWrapper.GetButtonDown(resetButton))
                {
                    ResetStages();
                }

                //if some action was performed, play the sound
                if (cooldownTimer == 0)
                {
                    transform.Find("ShipSounds").Find("CrewManagement").GetComponent <AudioSource>().Play();
                }
            }
        }
    }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (!isGameOver)
     {
         if (InputWrapper.GetButtonDown("Pause"))
         {
             CallPauseToggleEvent();
             CallMenuToggleEvent();
         }
     }
 }
Ejemplo n.º 5
0
    private void Update()
    {
        Vector3 throwVector = Boat.transform.forward * 2 + new Vector3(0, 0.05f, 0);

        if (InputWrapper.GetButtonDown("L1", Controller))
        {
            Shoot((-Boat.transform.right / 2 + throwVector) * Force + Boat.velocity, projectiles[Random.Range(0, projectiles.Length)]);
        }
        if (InputWrapper.GetButtonDown("R1", Controller))
        {
            Shoot((Boat.transform.right / 2 + throwVector) * Force + Boat.velocity, projectiles[Random.Range(0, projectiles.Length)]);
        }
    }
Ejemplo n.º 6
0
    /*
     * // The Update event checks for button inputs. When a stat buff is chosen, the
     * // appropriate stat function from the CrewManagement script is called. After
     * // stat calculations are done, DisplayUpdate() is called to update the UI.
     */

    // Update is called once per frame
    void Update()
    {
        if (InputWrapper.GetButtonDown(attackButton))
        {
            //crewManagement.AttackCrew();
            DisplayUpdate();
        }

        else if (InputWrapper.GetButtonDown(defenseButton))
        {
            //crewManagement.DefenseCrew();
            DisplayUpdate();
        }

        else if (InputWrapper.GetButtonDown(speedButton))
        {
            //crewManagement.SpeedCrew();
            DisplayUpdate();
        }
    }