Exemplo n.º 1
0
    protected override void LoadMenu()
    {
        catalog = turn.actor.GetComponentInChildren<AbilityCatalog> ();
        GameObject container = catalog.GetCategory (category);
        menuTitle = container.name;

        int count = catalog.AbilityCount (container);
        if (menuOptions == null)
            menuOptions = new List<string> ();
        else
            menuOptions.Clear ();

        bool[] locks = new bool[count];
        for (int i = 0; i < count; i++) {
            Ability ability = catalog.GetAbility(category, i);
            AbilityMagicCost cost = ability.GetComponent<AbilityMagicCost>();
            if(cost)
                menuOptions.Add(string.Format("{0}:{1}", ability.name, cost.amount));
            else
                menuOptions.Add(ability.name);
            locks[i] = !ability.CanPerform();
        }

        abilityMenuPanelController.Show (menuTitle, menuOptions);

        for (int i = 0; i < count; i++)
            abilityMenuPanelController.SetLocked (i, locks [i]);
    }
Exemplo n.º 2
0
    //Define menu options
    protected override void LoadMenu()
    {
        if (menuOptions == null)
        {
            menuOptions = new List <string>();
        }
        else
        {
            menuOptions.Clear();
        }

        //hard code the "attack" action
        menuTitle = "Action";
        menuOptions.Add("Attack");

        //load available abilities from unit components
        AbilityCatalog catalog = turn.actor.GetComponentInChildren <AbilityCatalog>();

        for (int i = 0; i < catalog.CategoryCount(); ++i)
        {
            menuOptions.Add(catalog.GetCategory(i).name);
        }

        abilityMenuPanelController.Show(menuTitle, menuOptions);
    }
Exemplo n.º 3
0
    protected override void LoadMenu()
    {
        catalog = turn.actor.GetComponentInChildren<AbilityCatalog>();
        GameObject container = catalog.GetCategory(category);
        menuTitle = container.name;

        int count = catalog.AbilityCount(container);
        if (menuOptions == null)
            menuOptions = new List<string>(count);
        else
            menuOptions.Clear();
        
        bool[] locks = new bool[count];
        for (int i = 0; i < count; ++i)
        {   
            Ability ability = catalog.GetAbility(category, i);
            AbilityMagicCost cost = ability.GetComponent<AbilityMagicCost>();
            if (cost)
                menuOptions.Add(string.Format("{0}: {1}", ability.name, cost.amount));
            else
                menuOptions.Add(ability.name);
            locks[i] = !ability.CanPerform();
        }

        abilityMenuPanelController.Show(menuTitle, menuOptions);
		for (int i = 0; i<count; ++i)
    		abilityMenuPanelController.SetLocked(i, locks[i]);
 	}
Exemplo n.º 4
0
 void Start()
 {
     owner = GetComponentInParent <Unit>();
     ac    = owner.GetComponentInChildren <AbilityCatalog>();
     bc    = gameObject.transform.parent.parent.parent.parent.gameObject.GetComponent <BattleController>();
     bmc   = bc.GetComponentInChildren <BattleMessageController>();
     cp    = bc.gameObject.GetComponent <ComputerPlayer>();
 }
Exemplo n.º 5
0
    public override void _Ready()
    {
        playerStats = (Stats)GetNode("/root/PlayerStats");
        playerStats.Connect("NoHealth", this, "queue_free");
        blinkAnimationPlayer = (AnimationPlayer)GetNode("BlinkAnimationPlayer");
        animationTree        = (AnimationTree)GetNode("AnimationTree");
        animationTree.Active = true;
        playerAnimationState = (AnimationNodeStateMachinePlayback)animationTree.Get("parameters/playback");

        //These pins are added to the player inventory temporarily for testing. They will be removed later.
        (string abilityAddress, string userAnimation, bool passive) = AbilityCatalog.SwordSwipe();
        PlayerPins.Add(new Pin {
            AbilityAddress = abilityAddress,
            UserAnimation  = userAnimation,
            Passive        = passive,
            Level          = 1,
            EXP            = 0,
            Quality        = 0,
            SlotNum        = 1
        });

        (abilityAddress, userAnimation, passive) = AbilityCatalog.Fireball();
        PlayerPins.Add(new Pin {
            AbilityAddress = abilityAddress,
            UserAnimation  = userAnimation,
            Passive        = passive,
            Level          = 1,
            EXP            = 0,
            Quality        = 0,
            SlotNum        = 2
        });

        (abilityAddress, userAnimation, passive) = AbilityCatalog.Thing();
        PlayerPins.Add(new Pin {
            AbilityAddress = abilityAddress,
            UserAnimation  = userAnimation,
            Passive        = passive,
            Level          = 1,
            EXP            = 0,
            Quality        = 0,
            SlotNum        = 3
        });

        (abilityAddress, userAnimation, passive) = AbilityCatalog.StandHeal();
        PlayerPins.Add(new Pin {
            AbilityAddress = abilityAddress,
            UserAnimation  = userAnimation,
            Passive        = passive,
            Level          = 1,
            EXP            = 0,
            Quality        = 0,
            SlotNum        = 6
        });

        SlotSets = BuildSlotSets(PlayerPins);
        LoadAbilities(SlotSets[currentSlotSet]);
    }
Exemplo n.º 6
0
        public static void LoadAbilityCatalog(string path)
        {
            string jsonString = File.ReadAllText(path);

            Console.WriteLine(jsonString);
            Ability[] abilities = JsonSerializer.Deserialize <Ability[]>(jsonString, options);
            for (int i = 0; i < abilities.Length; i++)
            {
                AbilityCatalog.Add(abilities[i]);
            }
        }
Exemplo n.º 7
0
    public Enemy(string name, string description, string type, int level, int maxHealth, int ranged, int magic, int melee, float critChance, float attackRange, int armor, int movementspeed, int baseAttackSpeed, int frostResistance, int fireResistance, bool aggressive, List <string> abilitiesString, Dictionary <Dictionary <string, int>, float> droptable)
    {
        this.name        = name;
        this.description = description;
        if (!typesAvailable.Contains(type))
        {
            throw new System.ArgumentException("That type does not exist");
        }
        else
        {
            this.type = type;
        }
        this.type              = type;
        this.level             = level;
        this.baseHealth        = maxHealth;
        this.ranged            = ranged;
        this.melee             = melee;
        this.magic             = magic;
        this.baseCritChance    = critChance;
        this.attackRange       = attackRange;
        this.baseArmor         = armor;
        this.baseMovementspeed = movementspeed;
        this.baseAttackSpeed   = baseAttackSpeed;
        this.frostResistance   = frostResistance;
        this.fireResistance    = fireResistance;
        this.aggressive        = aggressive;
        this.droptable         = droptable;


        abilityCatalog = GameObject.FindGameObjectWithTag("GameManager").GetComponent <AbilityCatalog>();

        if (abilitiesString.Count > 0)
        {
            foreach (string ability in abilitiesString)
            {
                if (abilityCatalog)
                {
                    //Debug.Log(abilityCatalog.getAbilityByName(ability));
                    //if(abilityCatalog.getAbilityByName(ability) != null){
                    this.abilities.Add(abilityCatalog.getAbilityByName(ability));
                    //} else {
                    //    throw new System.ArgumentException("Tried to add an ability that dont exist: " + ability);
                    //}
                }
                else
                {
                    Debug.Log("couldnt find catalog");
                }
            }
        }
    }
Exemplo n.º 8
0
        public static void TestAbilityCatalogSave()
        {
            Ability a1 = new Ability("1", "one", 1, Element.Air);
            Ability a2 = new Ability("2", "two", 1, Element.Fire);
            Ability a3 = new Ability("3", "three", 1, Element.Earth);
            Ability a4 = new Ability("4", "four", 1, Element.Water);

            AbilityCatalog.Add(a1);
            AbilityCatalog.Add(a2);
            AbilityCatalog.Add(a3);
            AbilityCatalog.Add(a4);

            JsonSaver.SaveAbilityCatalog("abilitycatalog.data");
            JsonSaver.LoadAbilityCatalog("abilitycatalog.data");
        }
Exemplo n.º 9
0
 void Awake()
 {
     //playerBehavior = GameObject.FindGameObjectWithTag("player").GetComponent<PlayerBehavior>();
     craftingSystem   = GetComponent <CraftingSystem>();
     buildingCatalog  = GetComponent <BuildingsCatalog>();
     itemCatalog      = GetComponent <ItemCatalog>();
     inventoryCatalog = GetComponent <InventoryCatalog>();
     citizenCatalog   = GetComponent <CitizenCatalog>();
     townCatalog      = GetComponent <TownCatalog>();
     enemyCatalog     = GetComponent <EnemyCatalog>();
     abilityCatalog   = GetComponent <AbilityCatalog>();
     perkCatalog      = GetComponent <PerkCatalog>();
     skillCatalog     = GetComponent <SkillCatalog>();
     UI             = GetComponent <UI>();
     messageLogText = GameObject.FindGameObjectWithTag("MessageLogBarUI").GetComponentInChildren <MessageLogText>();
     clock          = GetComponent <Clock>();
     world          = GameObject.FindGameObjectWithTag("World").GetComponent <World>();
 }
Exemplo n.º 10
0
        private void TakeTurn(Character character, Character other)
        {
            Console.WriteLine("What move do you want to do?");
            for (int i = 0; i < character.Abilities.List.Length; i++)
            {
                if (character.Abilities.List[i] == null)
                {
                    break;
                }
                Console.WriteLine(character.Abilities.List[i].ToString());
            }
            string move = Console.ReadLine();

            if (move.Equals(character.Abilities.List[0]) ||
                move.Equals(character.Abilities.List[1]))
            {
                Ability ability = AbilityCatalog.Get(move);
                ability.Use(other);
            }
            else
            {
                TakeTurn(character, other);
            }
        }
Exemplo n.º 11
0
 void Start()
 {
     owner = GetComponentInParent <Unit>();
     ac    = owner.GetComponentInChildren <AbilityCatalog>();
 }