public void selectAll() { if (allUnitFeatuers == null || allUnitFeatuers.Count == 0) { ruleManager.selectAll(); string query = "SELECT * FROM " + UNIT_TABLE_NAME + ""; SQLiteDataReader mReader = sqlManager.executeReader(query); List <UnitFeatures> unitList = new List <UnitFeatures>(); int Counter = 0; if (mReader.Read()) { do { Counter++; int id = mReader.GetInt32(0); string name = mReader.GetString(1); int powerSpawn = mReader.GetInt32(2); int powerMove = mReader.GetInt32(3); int powerAttack = mReader.GetInt32(4); float powerRegen = mReader.GetFloat(5); int airDamage = mReader.GetInt32(6); int groundDamage = mReader.GetInt32(7); float armorPricsingDamagePoint = mReader.GetFloat(8); float splashDamagePoint = mReader.GetFloat(9); int health = mReader.GetInt32(10); bool isArmored = mReader.GetBoolean(11); bool isGrounded = mReader.GetBoolean(12); int width = (int)mReader.GetFloat(15); int height = (int)mReader.GetFloat(16); int vision = mReader.GetInt32(17); int requiredLevel = mReader.GetInt32(18); int coinCost = mReader.GetInt32(19); int lastModified = mReader.GetInt32(21); int moveSpeed = mReader.GetInt32(22); string description = mReader.GetString(23); bool isVehicle = mReader.GetBoolean(24); int shotPerTurn = mReader.GetInt32(25); bool isInDeck; bool isLocked; int currentLevel; isInDeck = false; //mReader.GetBoolean(14); isLocked = false; //mReader.GetBoolean(13); currentLevel = 1; //mReader.GetInt32(20); UnitFeatures unit = new UnitFeatures(id, name, powerSpawn, powerMove, powerAttack, powerRegen, airDamage, groundDamage, armorPricsingDamagePoint, splashDamagePoint, health, isArmored, isGrounded, isLocked, isInDeck, width, height, vision, requiredLevel, coinCost, currentLevel, lastModified, moveSpeed, description, isVehicle, shotPerTurn);//,numberOfStateImages,numberOfDirections); List <UpgradeRule> upgradeRule = ruleManager.selectUnitUpgradeRule(id); unit.rules = upgradeRule; unitList.Add(unit); } while (mReader.Read()); } allUnitFeatuers = unitList; } }
public UnitFeatures clone() { UnitFeatures clonedFeatures = new UnitFeatures( this.id, this.name, this.powerSpawn, this.powerMove, this.powerAttack, this.powerRegen, this.airDamage, this.groundDamage, this.armorPricisingDamagePoint, this.splashDamagePoint, this.health, this.isArmored, this.isGroundUnit, this.isLocked, this.isInDeck, this.width, this.height, this.vision, this.requiredLevel, this.coinCost, this.currentLevel, this.lastModified, this.moveSpeed, this.description, this.isVehicle, this.shotPerTurn); clonedFeatures.rules = rules; return(clonedFeatures); }