示例#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);
    }
示例#2
0
    //given an index and the type of summon, summons that entity with the next available name
    public void BuildBuilding(int cellindex, string buildingname, string playerid)
    {
        Vector3 buildindex = hexGrid.GetCellPos(cellindex);

        buildindex.y = 0.2f;

        //Instantiate the prefab from the resources folder
        GameObject building   = (GameObject)Instantiate(Resources.Load(buildingname), buildindex, Quaternion.identity);
        Guid       buildingID = Guid.NewGuid();

        building.name = buildingID.ToString();
        char playerChar = playerid[0];

        buildingStorage.PlayerBuildingList(playerChar).Add(building);
        hexGrid.SetBuildingObject(cellindex, building);

        //sets stats for building
        buildingStats.SetPlayerID(building, playerid);
        buildingStats.SetType(building, buildingname);
        buildingStats.SetUniqueID(building, buildingID);
        buildingStats.SetCellIndex(building, cellindex);

        int health = buildingStats.GetMaxHealth(buildingname);

        buildingStats.SetMaxHealth(building, health);
        buildingStats.SetCurrHealth(building, health);
        int range = buildingStats.GetRange(buildingname);

        buildingStats.SetRange(building, range);
        int rangedattdmg = buildingStats.GetRangedAttackDmg(buildingname);

        buildingStats.SetRangedAttackDmg(building, rangedattdmg);
        int defense = buildingStats.GetDefense(buildingname);

        buildingStats.SetDefense(building, defense);
        int vision = buildingStats.GetVision(buildingname);

        buildingStats.SetVision(building, vision);

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