Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        if (Instance != null)
        {
            Debug.Log("There should never be more than one GameManager.");
            Destroy(this.gameObject);
            return;
        }
        Instance = this;
        GameObject.DontDestroyOnLoad(this.gameObject);

        // Set up MonsterData config file for use
        MonsterDataReader.SetUp();
        MonsterDataReader.ReadData();
        ConsumableDataReader.SetUp();
        ConsumableDataReader.ReadData();

        // Game loads Hero Data from save file,
        // IF NewGame - this save file is set to default in Launch-Menu Scene
        LoadGameData();
        AssignPlayerMonsterParty();


        //if (BSP_MapDictionary.Count < 1)
        //{
        //    SetBSPMapForFloor(playerStartFloor, new BSP_MapGen(dungeonMapWidth, dungeonMapHeight, baseFloorDifficulty));
        //    BSP_MapDictionary[playerStartFloor].GenerateBSPDungeon();
        //    playerDungeonPosition = BSP_MapDictionary[playerStartFloor].GetMapUpStairs;
        //}
    }
        Ability CreateConsumableAbilityFromData(string abilityName, int charges)
        {
            AbilityInfo consumableInfo = ConsumableDataReader.GetConsumableByName(abilityName);

            string  givenName         = consumableInfo.Name;
            Ability consumableAbility = new Ability(givenName, consumableInfo.AbilityCD, consumableInfo.ManaCost, charges);

            consumableAbility.SetTargetType(consumableInfo.targetType);
            consumableAbility.SetAbilityEffectType(consumableInfo.abilityEffectType);
            foreach (var effect in consumableInfo.abilityEffects)
            {
                AbilityEffect abilityEffect = new AbilityEffect()
                {
                    abilityType         = effect.abilityType,
                    damageType          = effect.damageType,
                    BaseAbilityStrength = effect.BaseAbilityStrength
                };
                consumableAbility.AddToEffectList(abilityEffect);
            }
            return(consumableAbility);

            // TODO... should never be allowed to happen, look inot more robust error handling
            return(null);
        }
    // TODO...
    // This is temporary hack
    // As long as we can set up a cache's data,
    // It doesn't matter how we do it here, becasue i will be completely reworking Dungeon Gen soon
    private List <AbilityInfo> PopulateConsumableLoot(int cacheDifficulty)
    {
        List <AbilityInfo> consumableList = new List <AbilityInfo>();

        if (cacheDifficulty < 3)
        {
            int consumableMarker = Random.Range(1, 6);
            switch (consumableMarker)
            {
            case 1:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                break;

            case 2:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                break;

            case 3:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 4:
            case 5:
                break;
            }
        }
        else if (cacheDifficulty < 8)
        {
            int consumableMarker = Random.Range(1, 6);
            switch (consumableMarker)
            {
            case 1:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                break;

            case 2:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 3:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 4:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Dynamite"));
                break;

            case 5:
                break;
            }
        }
        else
        {
            int consumableMarker = Random.Range(1, 6);
            switch (consumableMarker)
            {
            case 1:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                break;

            case 2:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Health Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 3:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Throwing Axe"));
                break;

            case 4:
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Mana Potion"));
                consumableList.Add(ConsumableDataReader.GetConsumableByName("Dynamite"));
                break;

            case 5:
                break;
            }
        }

        return(consumableList);
    }