private void check(ECharacterType type) { HittableCharacter c = upgrader.spawn(type); if (c.getSpawnCost() < minCost) { minCost = c.getSpawnCost(); cheapChoice = type; } if (c.spawnAttribute.speedFactor >= maxSpeed) { maxSpeed = c.spawnAttribute.speedFactor; speedyChoice = type; } if (c.spawnAttribute.meleeFactor >= maxMelee) { maxMelee = c.spawnAttribute.meleeFactor; meleeChoice = type; } if (c.spawnAttribute.rangeFactor >= maxRange) { maxRange = c.spawnAttribute.rangeFactor; rangeChoice = type; } if (c.spawnAttribute.aoeFactor >= maxAoe) { maxAoe = c.spawnAttribute.aoeFactor; aoeChoice = type; } }
public override CharacterEnums.ECharacterAction determineAction(HittableCharacter me, HittableTarget frontEnemy) { if (me.facing == CharacterEnums.EDirection.RIGHT) { if (me.getFrontLocationX() + meleeAttackDistance >= frontEnemy.getFrontLocationX()) { return(CharacterEnums.ECharacterAction.MELEEATTACK); } if (me.getFrontLocationX() + rangedAttackDistance >= frontEnemy.getFrontLocationX()) { return(CharacterEnums.ECharacterAction.RANGEATTACK); } } else { if (me.getFrontLocationX() - meleeAttackDistance <= frontEnemy.getFrontLocationX()) { return(CharacterEnums.ECharacterAction.MELEEATTACK); } if (me.getFrontLocationX() - rangedAttackDistance <= frontEnemy.getFrontLocationX()) { return(CharacterEnums.ECharacterAction.RANGEATTACK); } } return(CharacterEnums.ECharacterAction.WALKFORWARD); }
public override CharacterEnums.ECharacterAction determineAction(HittableCharacter me, HittableTarget frontEnemy) { CharacterEnums.ECharacterAction acc = base.determineAction(me, frontEnemy); if (acc == CharacterEnums.ECharacterAction.MELEEATTACK) { return(CharacterEnums.ECharacterAction.WALKBACKWARD); } else { return(acc); } }