Beispiel #1
0
    void Awake()
    {
        skillUI = gameObject.AddComponent <DisplaySkillStatus>();//new DisplaySkillStatus();
        skillUI.Init();

//        basicAttack = (GameObject)Resources.Load("Fireball");

        /*
         * // Use getaxis instead of keycode
         * keyCodes[0] = KeyCode.Space;
         * keyCodes[1] = KeyCode.LeftShift;
         * keyCodes[2] = KeyCode.E;
         *
         * skills[0] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SKILLMINE);
         * skills[1] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SKILLHASTE);
         * skills[2] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SKILLMIST);
         * skills[3] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SHIELD);*/

        key2skill.Add(KeyCode.Space, equippedSkills[0]     = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SKILLMINE));
        key2skill.Add(KeyCode.LeftShift, equippedSkills[1] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SKILLHASTE));
        //key2skill.Add(KeyCode.E, equippedSkills[2] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SKILLMIST));
        key2skill.Add(KeyCode.E, equippedSkills[2] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.TIMESLOW));

        equippedSkills[3] = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.SHIELD);

        skillUI.EquipSkill(key2skill);

        basicAttackSkill = SkillAssigner.AssignSkill(gameObject, SkillAssigner.SkillNames.TESTFIREBALL);
    }
Beispiel #2
0
 private void SwapSkill(KeyCode key, SkillAssigner.SkillNames skill)
 {
     if (key2skill.ContainsKey(key))
     {
         key2skill[key] = SkillAssigner.AssignSkill(gameObject, skill);
     }
     skillUI.EquipSkill(key2skill);
 }
Beispiel #3
0
    public void LoadPlayers(SkillProperties[] playerSkills, Stats[] playerStats)
    {
        GameObject playerObject = (GameObject)Resources.Load("Player");

        player = new PlayableChar[playerSkills.Length / 7];
        for (int i = 0; i < player.Length; i++)
        {
            GameObject playerObjectClone = Instantiate(playerObject, new Vector3(0f, 0f), transform.rotation);
            player[i] = playerObjectClone.GetComponent <PlayableChar>();
            player[i].SetPlayerState(2);    // For init purposes. This is required
            // Assign stats
            for (int j = 0; j < playerStats[i].maxCharStats.Length; j++)
            {
                player[i].SetMaxStat(j, playerStats[i].maxCharStats[j]);
            }

            // Equip block skills
            for (int j = i * playerSkills.Length / player.Length; j < playerSkills.Length / (player.Length - i); j++)
            {
                if (j % 7 < 4)
                {
                    player[i].EquipBlockSkill(j % 7, SkillAssigner.AssignSkill(playerObjectClone, playerSkills[j].name));
                }
                else
                {
                    player[i].EquipActiveSkill(j % 7 - 4, SkillAssigner.AssignActiveSkill(playerObjectClone, playerSkills[j].name));
                }
            }
        }

        // Assumption that Frea is player[0]. Need another way to address this
        player[0].GetControl().SetMaxJumps(2);

        /*
         *
         * REMOVE
         * */
        player[0].gameObject.GetComponent <SpriteRenderer>().sprite = Resources.Load("CharacterSprites/Sprite_scarecrow", typeof(Sprite)) as Sprite;
    }