示例#1
0
    public static PlayerCharacter GetCharacterLeft()
    {
        if (CharacterSelector.AreAllPlayersDead() == true)
        {
            Debug.LogError("GAME OVER!");
            return(null);
        }

        PlayerCharacter nextPlayer = null;

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

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

            return(nextPlayer);
        }

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

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

        return(nextPlayer);
    }
示例#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);
        }
    }