Ejemplo n.º 1
0
    public static PlayerCharacter GetCharacterRight()
    {
        if (CharacterSelector.AreAllPlayersDead() == true)
        {
            Debug.LogError("GAME OVER!");
            return(null);
        }

        PlayerCharacter nextPlayer = null;

        if (CharacterSelector.currentCharacterIndex >= CharacterSelector.characterNameList.Count - 1)
        {
            CharacterSelector.currentCharacterIndex = 0;
            nextPlayer = CharacterSelector.GetCharacterByType(CharacterSelector.characterNameList[0]);

            if (nextPlayer.isDead == true)
            {
                return(CharacterSelector.GetCharacterRight());
            }

            return(nextPlayer);
        }

        nextPlayer = CharacterSelector.GetCharacterByType(CharacterSelector.characterNameList[++CharacterSelector.currentCharacterIndex]);

        if (nextPlayer.isDead == true)
        {
            return(CharacterSelector.GetCharacterRight());
        }

        return(nextPlayer);
    }
Ejemplo n.º 2
0
    // Update is called once per frame
    private void Update()
    {
        if (this.currentControls.movementControl != null)
        {
            this.velocity = this.currentControls.movementControl.Vector;
        }
        else
        {
            this.velocity = Vector2.zero;
        }

        if (this.currentControls.rotateControl != null)
        {
            this.rotateDirection = this.currentControls.rotateControl.Vector;
        }
        else
        {
            this.rotateDirection = Vector2.zero;
        }

        if (this.currentControls.characterSelectLeft != null && this.currentControls.characterSelectRight.WasPressed)
        {
            this.SwapCharacter(CharacterSelector.GetCharacterRight());
        }

        if (this.currentControls.characterSelectRight != null && this.currentControls.characterSelectLeft.WasPressed)
        {
            this.SwapCharacter(CharacterSelector.GetCharacterLeft());
        }

        if (this.currentControls.attackButton != null && this.currentControls.attackButton.WasPressed)
        {
            this.Attack();
        }

        if (this.currentControls.attackButton != null && this.currentControls.attackButton.WasReleased)
        {
            this.currentCharacter.weapon.continueAttacking = false;
        }

        if (this.currentControls.interactButton != null && this.currentControls.interactButton.WasPressed)
        {
            this.InteractWithClosestObject();
        }

        if (this.device.Action2.WasPressed)
        {
            //this.DropEquipment(this.activeWeapon);
            //this.DropEquipment(this.activeArmor);
            this.ApplyStatusEffects(this.activeWeapon);
        }
    }