Exemplo n.º 1
0
    public static HeadPartInfo GetHeadPartInfo(string monsterName)
    {
        XmlDocument mainSprite = new XmlDocument();

        mainSprite.Load("Assets/Resources/Sprites/Monsters/" + monsterName + "/Head/Monster_" + monsterName + "_Head_Face_idle.svg");
        XmlDocument neckSprite = new XmlDocument();

        neckSprite.Load("Assets/Resources/Sprites/Monsters/" + monsterName + "/Head/Monster_" + monsterName + "_Head_neck.svg");
        XmlDocument hurtSprite = new XmlDocument();

        hurtSprite.Load("Assets/Resources/Sprites/Monsters/" + monsterName + "/Head/Monster_" + monsterName + "_Head_Face_hurt.svg");
        XmlDocument attackSprite = new XmlDocument();

        attackSprite.Load("Assets/Resources/Sprites/Monsters/" + monsterName + "/Head/Monster_" + monsterName + "_Head_Face_attack.svg");

        HeadPartInfo headPart = new HeadPartInfo()
        {
            monster      = monsterName,
            partType     = Helper.PartType.Head,
            mainSprite   = mainSprite.InnerXml,
            neckSprite   = neckSprite.InnerXml,
            hurtSprite   = hurtSprite.InnerXml,
            attackSprite = attackSprite.InnerXml
        };

        headPart = GetHeadAbilityInfo(headPart);

        return(headPart);
    }
Exemplo n.º 2
0
    public void PopulateSlots(Monster monster, string playerName)
    {
        //getting the part infos from the monster
        HeadPartInfo  headInfo     = monster.headPart.partInfo;
        TorsoPartInfo torsoInfo    = monster.torsoPart.partInfo;
        ArmPartInfo   rightArmInfo = monster.rightArmPart.partInfo;
        ArmPartInfo   leftArmInfo  = monster.leftArmPart.partInfo;
        LegPartInfo   legsInfo     = monster.legPart.partInfo;

        //populating the parts in to each slot
        headSlot.ChangePart(headInfo);
        torsoSlot.ChangePart(torsoInfo);
        rightArmSlot.ChangePart(rightArmInfo);
        leftArmSlot.ChangePart(leftArmInfo);
        legsSlot.ChangePart(legsInfo);

        //populating the weapons into each slot, if there are any equipped
        string rightWeapon = rightArmInfo.equippedWeapon;
        string leftWeapon  = leftArmInfo.equippedWeapon;

        if (rightWeapon != "")
        {
            rightWeaponSlot.ChangeWeapon(WeaponFactory.GetWeapon(rightWeapon, null, null, null));
        }
        if (leftWeapon != "")
        {
            leftWeaponSlot.ChangeWeapon(WeaponFactory.GetWeapon(leftWeapon, null, null, null));
        }

        //setting the name field text
        nameField.text = playerName;
    }
Exemplo n.º 3
0
    public override MonsterPartInfo InitializePickerButton(string monsterName, string partType)
    {
        partInfo         = PartFactory.GetHeadPartInfo(monsterName);
        faceImage.sprite = Helper.CreateSprite(partInfo.mainSprite, Helper.HeadImporter);
        neckImage.sprite = Helper.CreateSprite(partInfo.neckSprite, Helper.HeadImporter);

        return(partInfo);
    }
Exemplo n.º 4
0
    public override void ChangePart(MonsterPartInfo newPart)
    {
        partInfo = (HeadPartInfo)newPart;

        abilitySignLabel.text = partInfo.abilityName;
        abilityName           = partInfo.abilityName;
        abilityType           = partInfo.abilityType;
        abilityDesc           = partInfo.abilityDesc;

        UpdateUI();
    }
Exemplo n.º 5
0
 public void InitializeMonster(HeadPartInfo headInfo,
                               TorsoPartInfo torsoInfo,
                               ArmPartInfo rightArmInfo, ArmPartInfo leftArmInfo,
                               LegPartInfo legPartInfo)
 {
     headPart.InitializePart(headInfo);
     torsoPart.InitializePart(torsoInfo);
     rightArmPart.InitializePart(rightArmInfo);
     leftArmPart.InitializePart(leftArmInfo);
     legPart.InitializePart(legPartInfo);
 }
Exemplo n.º 6
0
    //fills the partInfo with the monster's ability name and description and returns it
    private static HeadPartInfo GetHeadAbilityInfo(HeadPartInfo partInfo)
    {
        switch (partInfo.monster)
        {
        case Helper.MonsterName.Robot:
            partInfo.abilityName     = "Laser Eyes";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Fire a single laser beam from your eyes";
            partInfo.abilityCooldown = 1;
            return(partInfo);

        case Helper.MonsterName.Frog:
            partInfo.abilityName     = "Tongue Flick";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Quickly flick out your tongue to attack enemies from a medium range";
            partInfo.abilityCooldown = 0.8f;
            return(partInfo);

        case Helper.MonsterName.Lion:
            partInfo.abilityName     = "Lion's Roar";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Let out a courageous roar to knock back enemies around you";
            partInfo.abilityCooldown = 1;
            return(partInfo);

        case Helper.MonsterName.Mummy:
            partInfo.abilityName     = "Acid Breath";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Cough up a cloud of acid that lingers in space and deals damage over time";
            partInfo.abilityCooldown = 4;
            return(partInfo);

        case Helper.MonsterName.Dingus:
            partInfo.abilityName     = "Big Beak";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Use your beak to peck at enemies";
            partInfo.abilityCooldown = 0.8f;
            return(partInfo);

        default:
            return(partInfo);
        }
    }
Exemplo n.º 7
0
    public override void ChangeSecondaryColor(string newColor)
    {
        if (partInfo.monster != "")
        {
            HeadPartInfo newPart = new HeadPartInfo()
            {
                monster         = partInfo.monster,
                abilityName     = partInfo.abilityName,
                abilityType     = partInfo.abilityType,
                abilityDesc     = partInfo.abilityDesc,
                abilityCooldown = partInfo.abilityCooldown,
                mainSprite      = ChangeColor(partInfo.mainSprite, "SECONDARY", newColor),
                neckSprite      = ChangeColor(partInfo.neckSprite, "SECONDARY", newColor),
                hurtSprite      = ChangeColor(partInfo.hurtSprite, "SECONDARY", newColor),
                attackSprite    = ChangeColor(partInfo.attackSprite, "SECONDARY", newColor)
            };

            partInfo = newPart;
            UpdateUI();
        }
    }
Exemplo n.º 8
0
    public void InitializePart(HeadPartInfo headPartInfo)
    {
        //this mainly is used to check whether the part is attached to the player
        PlayerController player = GetComponentInParent <PlayerController>();

        if (headPartInfo != null)
        {
            partInfo = headPartInfo;

            //checking whether this part has an ability
            if (partInfo.abilityName != null && player != null)
            {
                //populating the partAbility field with the appropriate ability delegate
                partAbility = AbilityFactory.GetPartAbility(partInfo.abilityName);

                //if the type is Passive, run the delegate method to apply the buff to the player
                if (partInfo.abilityType == "Passive")
                {
                    partAbility();
                }//if the type is Activate, set the ability to the Player action delegate
                else if (partInfo.abilityType == "Activate")
                {
                    player.headAbilityDelegate = partAbility;
                }
            }

            if (GetComponentInParent <Enemy>() == null)
            {
                idleFaceSprite   = Helper.CreateSprite(partInfo.mainSprite, Helper.HeadImporter);
                hurtFaceSprite   = Helper.CreateSprite(partInfo.hurtSprite, Helper.HeadImporter);
                attackFaceSprite = Helper.CreateSprite(partInfo.attackSprite, Helper.HeadImporter);
                neckSprite       = Helper.CreateSprite(partInfo.neckSprite, Helper.HeadImporter);
            }

            face.sprite = idleFaceSprite;
            neck.sprite = neckSprite;
        }
    }
Exemplo n.º 9
0
    public void InitializePlayer()
    {
        //creating variables to initialize the player monster
        //this code is for testing purposes, final product will pull this information from the database scripts

        HeadPartInfo  headInfo     = new HeadPartInfo();
        TorsoPartInfo torsoInfo    = new TorsoPartInfo();
        ArmPartInfo   rightArmInfo = new ArmPartInfo();
        ArmPartInfo   leftArmInfo  = new ArmPartInfo();
        LegPartInfo   legPartInfo  = new LegPartInfo();

        //initializing the Head
        if (head != "")
        {
            headInfo = PartFactory.GetHeadPartInfo(head);
        }
        else
        {
            headInfo = GameManager.instance.gameFile.player.headPart;
        }
        //initializing the Torso
        if (torso != "")
        {
            torsoInfo = PartFactory.GetTorsoPartInfo(torso);
        }
        else
        {
            torsoInfo = GameManager.instance.gameFile.player.torsoPart;
        }
        //initializing the RightArm
        if (rightArm != "")
        {
            rightArmInfo = PartFactory.GetArmPartInfo(rightArm, Helper.PartType.RightArm);
            rightArmInfo.equippedWeapon = rightWeapon;
        }
        else
        {
            rightArmInfo = GameManager.instance.gameFile.player.rightArmPart;
        }
        //initializing the LeftArm
        if (leftArm != "")
        {
            leftArmInfo = PartFactory.GetArmPartInfo(leftArm, Helper.PartType.LeftArm);
            leftArmInfo.equippedWeapon = leftWeapon;
        }
        else
        {
            leftArmInfo = GameManager.instance.gameFile.player.leftArmPart;
        }
        //initializing the Legs
        if (legs != "")
        {
            legPartInfo = PartFactory.GetLegPartInfo(legs);
        }
        else
        {
            legPartInfo = GameManager.instance.gameFile.player.legsPart;
        }


        moveDelegate         = Move;
        jumpDelegate         = Jump;
        rightAttackDelegate  = RightAttack;
        leftAttackDelegate   = LeftAttack;
        torsoAbilityDelegate = AbilityDefault;
        headAbilityDelegate  = AbilityDefault;

        playerCheckDelegate += UpdatePlayerDirection;
        playerCheckDelegate += UpdatePlayerInputCooldowns;
        playerCheckDelegate += CheckHitBox;

        monster.InitializeMonster(headInfo, torsoInfo, rightArmInfo, leftArmInfo, legPartInfo);

        SetPlayerCooldowns();
        //setting the cooldown timers so that the player can use the inputs as soon as the game loads
        rightAttackTimer  = RightAttackCooldown;
        leftAttackTimer   = LeftAttackCooldown;
        headAbilityTimer  = HeadAbilityCooldown;
        torsoAbilityTimer = TorsoAbilityCooldown;
        legAbilityTimer   = LegAbilityCooldown;
    }