コード例 #1
0
    public static bool abilityEnabled(int abilityIndex)
    {
        GameObject playerObject = Managers.Player.gameObject;

        switch (abilityIndex)
        {
        case (int)Cheat.FORCE_LAUNCH:
            ForceLaunchAbility fta = playerObject.GetComponent <ForceLaunchAbility>();
            return(fta.Active);

        case (int)Cheat.WALL_CLIMB:
            WallClimbAbility wca = playerObject.GetComponent <WallClimbAbility>();
            return(wca.Active);

        case (int)Cheat.ELECTRIC_BEAM:
            ElectricBeamAbility eba = playerObject.GetComponent <ElectricBeamAbility>();
            return(eba.Active);

        case (int)Cheat.SWAP:
            SwapAbility sa = playerObject.GetComponent <SwapAbility>();
            return(sa.Active);

        case (int)Cheat.AIR_SLICE:
            AirSliceAbility asa = playerObject.GetComponent <AirSliceAbility>();
            return(asa.Active);

        case (int)Cheat.LONG_TELEPORT:
            LongTeleportAbility lta = playerObject.GetComponent <LongTeleportAbility>();
            return(lta.Active);

        default:
            throw new System.ArgumentException("abilityIndex is invalid!: " + abilityIndex);
        }
    }
コード例 #2
0
    public static void enableAbility(int abilityIndex, bool enable)
    {
        GameObject playerObject = Managers.Player.gameObject;

        switch (abilityIndex)
        {
        case (int)Cheat.FORCE_LAUNCH:
            ForceLaunchAbility fta = playerObject.GetComponent <ForceLaunchAbility>();
            fta.Active = enable;
            break;

        case (int)Cheat.WALL_CLIMB:
            WallClimbAbility wca = playerObject.GetComponent <WallClimbAbility>();
            wca.Active = enable;
            break;

        case (int)Cheat.ELECTRIC_BEAM:
            ElectricBeamAbility eba = playerObject.GetComponent <ElectricBeamAbility>();
            eba.Active = enable;
            break;

        case (int)Cheat.SWAP:
            SwapAbility sa = playerObject.GetComponent <SwapAbility>();
            sa.Active = enable;
            break;

        case (int)Cheat.AIR_SLICE:
            AirSliceAbility asa = playerObject.GetComponent <AirSliceAbility>();
            asa.Active = enable;
            break;

        case (int)Cheat.LONG_TELEPORT:
            LongTeleportAbility lta = playerObject.GetComponent <LongTeleportAbility>();
            lta.Active = enable;
            break;
        }
    }