Ignore:
Timestamp:
2014-07-23 15:12:08 (6 years ago)
Author:
anlakane
Message:

Lisätty mm. ampuminen ja vihollisten tekoälyä.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2014/30/MiskaK/The Reclaim/The Reclaim/The Reclaim/The Reclaim/Entrance.cs

    r5554 r5602  
    144144    } 
    145145 
     146    public List<Soldier> GetSoldiersInside(Entrance.Owner enemyType) 
     147    { 
     148        List<Soldier> soldsInside = new List<Soldier>(); 
     149 
     150        if (enemyType == Owner.Friendly) 
     151        { 
     152            for (int i = 0; i < The_Reclaim.Peli.FriendlyTroops.Count; i++) 
     153                if (IsInside(The_Reclaim.Peli.FriendlyTroops[i].Position)) soldsInside.Add(The_Reclaim.Peli.FriendlyTroops[i]); 
     154        } 
     155        else 
     156        { 
     157            for (int i = 0; i < The_Reclaim.Peli.HostileTroops.Count; i++) 
     158                if (IsInside(The_Reclaim.Peli.HostileTroops[i].Position)) soldsInside.Add(The_Reclaim.Peli.HostileTroops[i]); 
     159        } 
     160        return soldsInside; 
     161    } 
     162 
     163    /// <summary> 
     164    /// Onko jokin piste Entrancen sisäpuolella. 
     165    /// </summary> 
     166    /// <param name="position">Tutkittava piste.</param> 
     167    /// <returns></returns> 
     168    public bool IsInside(Vector position) 
     169    { 
     170        return Vector.Distance(position, this.Position) < this.Radius; 
     171    } 
     172 
    146173    public void Spawn() 
    147174    { 
     
    150177            case Owner.Friendly: 
    151178                for (int i = 0; i < RandomGen.NextInt(GameConstants.MINIMUM_SPAWN_COUNT, GameConstants.MAXIMUM_SPAWN_COUNT); i++) 
    152                     The_Reclaim.Peli.CreateSoldier(this.Position + RandomGen.NextVector(-this.Radius / 2, this.Radius / 2), Images.PelaajaTesti, true, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), RandomGen.NextAngle()); 
     179                    The_Reclaim.Peli.CreateSoldier(this.Position + RandomGen.NextVector(-this.Radius / 2, this.Radius / 2), Images.OmaSotilasAKS74u, true, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), RandomGen.NextAngle()); 
    153180                break; 
    154181            case Owner.Enemy: 
    155182                for (int i = 0; i < RandomGen.NextInt(GameConstants.MINIMUM_SPAWN_COUNT, GameConstants.MAXIMUM_SPAWN_COUNT); i++) 
    156                     The_Reclaim.Peli.CreateSoldier(this.Position + RandomGen.NextVector(-this.Radius / 2, this.Radius / 2), Images.PelaajaTesti, false, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), RandomGen.NextAngle()); 
     183                    The_Reclaim.Peli.CreateSoldier(this.Position + RandomGen.NextVector(-this.Radius / 2, this.Radius / 2), Images.VihollinenVSSVintorez, false, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), RandomGen.NextAngle()); 
    157184                break; 
    158185            case Owner.Neutral: 
Note: See TracChangeset for help on using the changeset viewer.