Exemplo n.º 1
0
    //given an index and the type of summon, summons that entity with the next available name
    public void SummonEntity(int cellindex, string summonname, string playerid)
    {
        Vector3 summonindex = hexGrid.GetCellPos(cellindex);

        summonindex.y = 0.2f;

        //Instantiate the prefab from the resources folder, add to player entity list and set it to the hex tile
        GameObject entity   = (GameObject)Instantiate(Resources.Load(summonname), summonindex, Quaternion.identity);
        Guid       entityID = Guid.NewGuid();

        entity.name = entityID.ToString();
        char playerChar = playerid[0];

        entityStorage.PlayerEntityList(playerChar).Add(entity);
        hexGrid.SetEntityObject(cellindex, entity);

        //sets stats for entity
        entityStats.SetPlayerID(entity, playerid);
        entityStats.SetType(entity, summonname);
        entityStats.SetUniqueID(entity, entityID);
        entityStats.SetCellIndex(entity, cellindex);

        int health = entityStats.GetMaxHealth(summonname);

        entityStats.SetMaxHealth(entity, health);
        entityStats.SetCurrHealth(entity, health);
        int mana = entityStats.GetMaxMana(summonname);

        entityStats.SetMaxMana(entity, mana);
        entityStats.SetCurrMana(entity, mana);
        int dmg = entityStats.GetAttackDmg(summonname);

        entityStats.SetAttackDmg(entity, dmg);
        int attpt = entityStats.GetMaxAttackPoint(summonname);

        entityStats.SetMaxAttackPoint(entity, attpt);
        int movept = entityStats.GetMaxMovementPoint(summonname);

        entityStats.SetMaxMovementPoint(entity, movept);
        int range = entityStats.GetRange(summonname);

        entityStats.SetRange(entity, range);
        int rangedattdmg = entityStats.GetRangedAttackDmg(summonname);

        entityStats.SetRangedAttackDmg(entity, rangedattdmg);
        int armor = entityStats.GetArmor(summonname);

        entityStats.SetArmor(entity, armor);
        int armorpiercing = entityStats.GetArmorPiercing(summonname);

        entityStats.SetArmorPiercing(entity, armorpiercing);
        int rangedarmorpiercing = entityStats.GetRangedArmorPiercing(summonname);

        entityStats.SetRangedArmorPiercing(entity, rangedarmorpiercing);
        int vision = entityStats.GetVision(summonname);

        entityStats.SetVision(entity, vision);

        loadMap.CreateHealthLabel(cellindex, health, entity.name);
    }