コード例 #1
0
        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;
            }
        }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
     }
 }