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/The_Reclaim.cs

    r5555 r5602  
    2121 
    2222    public Timer AITick = new Timer(); 
     23    private int CurrentTick = 1; 
    2324 
    2425    public List<LevelData> Levels = new List<LevelData>(); 
    2526    public LevelData CurrentLevel; 
    26  
    27     public List<GameObject> effectObjects = new List<GameObject>(); 
    2827 
    2928    private Vector TroopSelectionCorner; 
     
    150149    } 
    151150 
    152     /// <summary> 
    153     /// Lisätään tietorakenteeseen uusi tehosteobjekti ja poistetaan 
    154     /// vanha, jos objekteja on liikaa. 
    155     /// </summary> 
    156     /// <param name="tehoste">Lisättävä objekti.</param> 
    157     public void LisaaTehosteObjekti(GameObject tehoste) 
    158     { 
    159         effectObjects.Add(tehoste); 
    160         if (effectObjects.Count > GameConstants.MAX_NUMBER_OF_EFFECT_OBJECTS) 
    161         { 
    162             effectObjects[0].Destroy(); 
    163             effectObjects.RemoveAt(0); 
    164         } 
    165     } 
    166  
    167151    void UpdateFoW(GameObject fow) 
    168152    { 
     
    208192    { 
    209193        SmoothTextures = false; 
    210         Level.BackgroundColor = Color.White; 
     194        Level.BackgroundColor = Color.Black; 
    211195        Camera.ZoomToAllObjects(); 
    212196        Mouse.IsCursorVisible = true; 
     
    325309        s.MovingSpeed = speed; 
    326310        s.CollisionIgnoreGroup = 1; 
    327         s.Weapon = ase; 
     311        s.SetWeapon(ase); 
    328312        s.Weapon.UsesTracers = true; 
    329         s.LinearDamping = 0.98; 
     313        s.LinearDamping = 0.95; 
     314        s.AngularDamping = 0.98; 
     315        s.Mass = 100; 
     316        EnemySpecialization[] specs = { EnemySpecialization.Attacker, EnemySpecialization.Defender, EnemySpecialization.Killer }; 
    330317 
    331318        if (isPlayerControlled) 
     
    336323        { 
    337324            HostileTroops.Add(s); 
     325            s.Specialization = RandomGen.SelectOneWithProbabilities<EnemySpecialization>(specs, 0.3, 0.5, 0.2); // eniten defendereitä, toiseksi eniten attackereita ja vähiten killereitä 
     326            s.Name.Text += " (" + s.Specialization.ToString() + ")"; 
    338327        } 
    339328        Add(s); 
     
    368357 
    369358 
    370         Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { CreateSoldier(Mouse.PositionOnWorld, Images.PelaajaTesti, true, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), Angle.Zero); }, null); 
    371         Keyboard.Listen(Key.RightControl, ButtonState.Pressed, delegate { CreateSoldier(Mouse.PositionOnWorld, Images.PelaajaTesti, false, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), Angle.Zero); }, null); 
     359        Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { CreateSoldier(Mouse.PositionOnWorld, Images.OmaSotilasAKS74u, true, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), Angle.Zero); }, null); 
     360        Keyboard.Listen(Key.RightControl, ButtonState.Pressed, delegate { CreateSoldier(Mouse.PositionOnWorld, Images.VihollinenVSSVintorez, false, RandomGen.NextDouble(GameConstants.SOLDIER_MIN_SPEED, GameConstants.SOLDIER_MAX_SPEED), Aseet.GetRandomWeapon(), Angle.Zero); }, null); 
    372361        //Keyboard.Listen(Key.Space, ButtonState.Pressed, delegate { MessageDisplay.Add(Mouse.PositionOnWorld.ToString()); MessageDisplay.Add(NavigationMesh.GetCorrespondingNode(Mouse.PositionOnWorld).ToString()); }, null); 
    373362        Keyboard.Listen(Key.W, ButtonState.Down, LiikutaKameraa, null, new Vector(0.0, 1.0)); 
     
    380369    void LiikutaKameraa(Vector suunta) 
    381370    { 
    382         Camera.Position += (suunta * GameConstants.CAMERA_MOVEMENT_SPEED); 
     371        if (Camera.ZoomFactor > 1) 
     372            Camera.Position += (suunta * GameConstants.CAMERA_MOVEMENT_SPEED / Camera.ZoomFactor); 
     373        else 
     374            Camera.Position += (suunta * GameConstants.CAMERA_MOVEMENT_SPEED); 
     375 
    383376    } 
    384377 
     
    490483                                Soldier s = (Soldier)soldiersInArea[j]; 
    491484                                if (!s.IsPlayerControlled) 
    492                                     SelectedTroops[i].TargetSoldiers.Add(s); 
     485                                    SelectedTroops[i].AddTargetSoldier(s); 
    493486                            } 
    494487                            for (int j = 0; j < SelectedTroops[i].TargetSoldiers.Count; j++) 
     
    524517        { 
    525518            HostileTroops[i].UpdateAI(); 
     519            if (CurrentTick == 1) 
     520                HostileTroops[i].UpdateEnemyObjectives(); 
     521            CurrentTick++; 
     522            if (CurrentTick > GameConstants.ENEMY_AI_OBJECTIVE_REFRESH_TICKS) 
     523                CurrentTick = 1; 
    526524        } 
    527525    } 
Note: See TracChangeset for help on using the changeset viewer.