示例#1
0
    public override MonsterPartInfo InitializePickerButton(string monsterName, string partType)
    {
        partInfo          = PartFactory.GetTorsoPartInfo(monsterName);
        torsoImage.sprite = Helper.CreateSprite(partInfo.mainSprite, Helper.TorsoImporter);

        return(partInfo);
    }
示例#2
0
    public void InitializePart(TorsoPartInfo torsoPartInfo)
    {
        //this mainly is used to check whether the part is attached to the player
        PlayerController player = GetComponentInParent <PlayerController>();

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

            //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.torsoAbilityDelegate = partAbility;
                }
            }

            if (GetComponentInParent <Enemy>() == null)
            {
                bodySprite = Helper.CreateSprite(partInfo.mainSprite, Helper.TorsoImporter);
            }

            body.sprite = bodySprite;
        }
    }
示例#3
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;
    }
示例#4
0
    public override void ChangePart(MonsterPartInfo newPart)
    {
        partInfo = (TorsoPartInfo)newPart;

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

        UpdateUI();
    }
示例#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);
 }
示例#6
0
    public static TorsoPartInfo GetTorsoPartInfo(string monsterName)
    {
        XmlDocument mainSprite = new XmlDocument();

        mainSprite.Load("Assets/Resources/Sprites/Monsters/" + monsterName + "/Torso/Monster_" + monsterName + "_Torso.svg");

        TorsoPartInfo torsoPart = new TorsoPartInfo()
        {
            monster    = monsterName,
            partType   = Helper.PartType.Torso,
            mainSprite = mainSprite.InnerXml
        };

        torsoPart = GetTorsoAbilityInfo(torsoPart);

        return(torsoPart);
    }
示例#7
0
    //fills the partInfo with the monster's ability name and description and returns it
    private static TorsoPartInfo GetTorsoAbilityInfo(TorsoPartInfo partInfo)
    {
        switch (partInfo.monster)
        {
        case Helper.MonsterName.Robot:
            partInfo.abilityName     = "Armored Body";
            partInfo.abilityType     = "Passive";
            partInfo.abilityDesc     = "Gain an extra heart of health";
            partInfo.abilityCooldown = 0;
            return(partInfo);

        case Helper.MonsterName.Shark:
            partInfo.abilityName     = "Gills";
            partInfo.abilityType     = "Passive";
            partInfo.abilityDesc     = "Gain the ability to breath underwater";
            partInfo.abilityCooldown = 0;
            return(partInfo);

        case Helper.MonsterName.Turtle:
            partInfo.abilityName     = "Hard Shell";
            partInfo.abilityType     = "Passive";
            partInfo.abilityDesc     = "You cannot be hurt by attacks from behind, but melee attacks will still knock you back";
            partInfo.abilityCooldown = 0;
            return(partInfo);

        case Helper.MonsterName.Knight:
            partInfo.abilityName     = "Ghost Walk";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Dissappear, then reappear further ahead in the direction you are facing";
            partInfo.abilityCooldown = 1;
            return(partInfo);

        case Helper.MonsterName.Wingus:
            partInfo.abilityName     = "Swoop da Woop";
            partInfo.abilityType     = "Activate";
            partInfo.abilityDesc     = "Fly backwards into the air to escape any danger coming from the front, does not work underwater";
            partInfo.abilityCooldown = 0;
            return(partInfo);

        default:
            return(partInfo);
        }
    }
示例#8
0
    public override void ChangeSecondaryColor(string newColor)
    {
        if (partInfo.monster != "")
        {
            TorsoPartInfo newPart = new TorsoPartInfo()
            {
                monster         = partInfo.monster,
                abilityName     = partInfo.abilityName,
                abilityType     = partInfo.abilityType,
                abilityDesc     = partInfo.abilityDesc,
                abilityCooldown = partInfo.abilityCooldown,
                mainSprite      = ChangeColor(partInfo.mainSprite, "SECONDARY", newColor)
            };


            partInfo = newPart;
            UpdateUI();
        }
    }
示例#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;
    }