Ignore:
Timestamp:
2014-07-22 22:11:34 (6 years ago)
Author:
mikrkana
Message:

Korjattu SeesObject?-bugi ja lisätty etu- ja sukunimiä.

File:
1 edited

Legend:

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

    r5554 r5555  
    8686        if (!IsPlayerControlled) 
    8787        { 
    88             this.TargetLocation = RandomGen.SelectOne<Soldier>(The_Reclaim.Peli.FriendlyTroops).Position; 
     88            if (The_Reclaim.Peli.FriendlyTroops.Count != 0) 
     89                this.TargetLocation = RandomGen.SelectOne<Soldier>(The_Reclaim.Peli.FriendlyTroops).Position; 
    8990            this.CurrentBehaviour = Behaviour.Move; 
    9091        } 
     
    105106                break; 
    106107            case Behaviour.Shoot: 
    107                 /*if (ShootingTargetArea != null) 
    108                 { 
    109                     List<GameObject> kohteetAlueella = The_Reclaim.Peli.GetObjects(x => x is Soldier && The_Reclaim.Peli.IsInside(x.Position, ShootingTargetArea.FirstCorner, ShootingTargetArea.SecondCorner) && x != this); 
    110                     List<GameObject> kohteetNakyvilla = kohteetAlueella.FindAll(x =>  
    111                         this.SeesObject(x)); 
    112                     if (kohteetNakyvilla.Count == 0) return; 
    113                     Soldier kohde = SelectOptimalTarget(kohteetNakyvilla); 
    114                     this.Angle = (kohde.Position - this.Position).Angle; 
    115                     Shoot(); 
    116                 }*/ 
     108                //List<Soldier> kohteetNakyvilla = TargetSoldiers.FindAll(x => this.SeesObject(x, "seina")).; 
     109 
    117110                List<GameObject> kohteetNakyvilla = new List<GameObject>(); 
    118111                for (int i = 0; i < TargetSoldiers.Count; i++) 
    119112                { 
    120                     //if (this.SeesSoldier(this, TargetSoldiers[i])) 
    121                     //{ 
     113                    if (this.SeesObject(TargetSoldiers[i], "seina")) 
     114                    { 
    122115                        kohteetNakyvilla.Add(TargetSoldiers[i]); 
    123                     //} 
     116                    } 
    124117                } 
     118 
    125119                if (kohteetNakyvilla.Count != 0) 
    126120                { 
     
    134128        } 
    135129    } 
    136  
    137     /// <summary> 
    138     /// Näkeekö olio toisen. 
    139     /// </summary> 
    140     /// <param name="second">Toinen olio</param> 
    141     /// <returns></returns> 
    142     public bool SeesSoldier(Soldier first, Soldier second) 
    143     { 
    144         return Game.Instance.GetFirstObject(obstacle => obstacle != first && obstacle != second && !(obstacle is Widget) && obstacle.IsBlocking(first.Position, second.Position)) == null; 
    145     } 
    146  
    147130 
    148131    /// <summary> 
Note: See TracChangeset for help on using the changeset viewer.