コード例 #1
0
ファイル: Engine.cs プロジェクト: nikolaynikolov/Telerik
 private void AddRacket(GameObject obj)
 {
     // remove the previous racket from this.allObjects and this.staticObjects
     RemoveRacket();
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #2
0
ファイル: Engine.cs プロジェクト: Varbanov/TelerikAcademy
 private void AddRacket(GameObject obj)
 {
     //TODO: we should remove the previous racket from this.allObjects
     //the solution is above, in AddObject()
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #3
0
ファイル: Engine.cs プロジェクト: quela/myprojects
 /* Search for a "TODO" in the Engine class, regarding the AddRacket method. Solve the problem mentioned there.
  * There should always be only one Racket. Note: comment in TODO not completely correct*/
 private void AddRacket(GameObject obj)
 {
     //TODO: we should remove the previous racket from this.allObjects
     RemovePreviousRacket();
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #4
0
        private void AddRacket(GameObject obj)
        {
            this.allObjects.RemoveAll(item => item is Racket); // [Task 3]
            this.staticObjects.RemoveAll(item => item is Racket); // [Task 3]

            this.playerRacket = obj as Racket;
            this.AddStaticObject(obj);
        }
コード例 #5
0
ファイル: Engine.cs プロジェクト: niki-funky/Telerik_Academy
 private void AddRacket(GameObject obj)
 {
     //all previous Rackets removed
     this.allObjects.RemoveAll(x => x is Racket);
     this.staticObjects.RemoveAll(x => x is Racket);
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #6
0
 private void AddRacket(GameObject obj)
 {
     //TODO: we should remove the previous racket from this.allObjects
     this.playerRacket = obj as Racket;
     this.allObjects.RemoveAll(ob => ob is Racket);
     this.staticObjects.RemoveAll(ob => ob is Racket);
     this.AddStaticObject(obj);
 }
コード例 #7
0
ファイル: ShootingEngine.cs プロジェクト: staafl/misc
 public override void AddObject(GameObject obj)
 {
     var as_racket = obj as ShootingRacket;
     if (as_racket != null) {
         racket = as_racket;
     }
     base.AddObject(obj);
 }
コード例 #8
0
ファイル: Engine.cs プロジェクト: huoxudong125/TelerikAcademy
 public void AddTrailingObject(GameObject obj)
 {
     if (obj is TrailObject)
     {
         allObjects.Add(obj as TrailObject);
         staticObjects.Add(obj as TrailObject);
     }
 }
コード例 #9
0
 //overriding of this method is important for task 13 in order to get access to the fields of the current racket
 public override void AddObject(GameObject obj)
 {
     if (obj is ShootingRacket)
     {
         ShootingRacket newRacket = obj as ShootingRacket;
         this.playerRacket = newRacket;
     }
     base.AddObject(obj);
 }
コード例 #10
0
ファイル: Engine.cs プロジェクト: RosenTodorov/MyProjects
        private void AddRacket(GameObject obj)
        {
            //TODO: we should remove the previous racket from this.allObjects
            // 3. Removing the rackets from allObjects and staticObjects

            this.playerRacket = obj as Racket;
            this.allObjects.RemoveAll(item => item is Racket); // this line should be as comment if we use multiple rackets
            this.staticObjects.RemoveAll(item => item is Racket);
            this.AddStaticObject(obj);
        }
コード例 #11
0
ファイル: Engine.cs プロジェクト: aleks-todorov/HomeWorks
        private void AddRacket(GameObject obj)
        {
            //TODO: we should remove the previous racket from this.allObjects
            //Task 3: Implementing Removing of all elements of Type Racket from allObjects
            var toRemove = this.allObjects.OfType<Racket>().ToList();
            foreach (var item in toRemove)
                this.allObjects.Remove(item);

            this.playerRacket = obj as Racket;
            this.AddStaticObject(obj);
        }
コード例 #12
0
ファイル: Engine.cs プロジェクト: nzhul/TelerikAcademy
        private void AddRacket(GameObject obj)
        {
            //TODO: we should remove the previous racket from this.allObjects

            // 03. Removing the old Racket using Lambda
            // We can also search the whole list of objects and remove the object that is Racket
            this.allObjects.RemoveAll(item => item is Racket);
            this.staticObjects.RemoveAll(item => item is Racket);

            this.playerRacket = obj as Racket;
            this.AddStaticObject(obj);
        }
コード例 #13
0
 private void AddRacket(GameObject obj)
 {
     for(int i = 0; i < allObjects.Count; i++) {
       if(allObjects[i] is Racket) {
         allObjects.RemoveAt(i);
         break;
       }
     }
     //TODO: we should remove the previous racket from this.allObjects
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #14
0
ファイル: Engine.cs プロジェクト: Termininja/TelerikAcademy
 // Add some object in depending his type
 public virtual void AddObject(GameObject obj)
 {
     if (obj is MovingObject)
     {
         this.AddMovingObject(obj as MovingObject);
     }
     else
     {
         if (obj is Racket) AddRacket(obj);
         else this.AddStaticObject(obj);
     }
 }
コード例 #15
0
        private void AddRacket(GameObject obj)
        {
            //TODO: we should remove the previous racket from this.allObjects
           /* 03. Search for a "TODO" in the Engine class, regarding the AddRacket method. 
            * Solve the problem mentioned there. There should always be only one Racket. 
            * Note: comment in TODO not completely correct
            */

            this.playerRacket = obj as Racket;
            this.allObjects.RemoveAll(x => x is Racket); // should be always one racket
            this.AddStaticObject(obj);
        }
コード例 #16
0
ファイル: Engine.cs プロジェクト: PetarPenev/Telerik
 // Task 3 - I have decided that, since it was mentioned that the comment in the code was not completely correct and
 // that the only condition is to have one racket, to keep the original racket. The method checks whether we have
 // a Racket object in the list of all objects and then, if not, to add the racket.5
 protected virtual void AddRacket(GameObject obj)
 {
     bool check=true;
     foreach (var c in this.allObjects)
     {
         if (c is Racket)
             check = false;
     }
     if (check)
     {
         this.playerRacket = obj as Racket;
         this.AddStaticObject(obj);
     }
 }
コード例 #17
0
 private void AddRacket(GameObject obj)
 {
     //3.Search for TODO and remove racket. There should always be only one racket.
     //TODO: we should remove the previous racket from this.allObjects
     this.playerRacket = obj as Racket;
     for (int i = 0; i < allObjects.Count; i++)
     {
         if (allObjects[i] is Racket)
         {
             allObjects.RemoveAt(i);
             break;
         }
     }
     this.AddStaticObject(obj);
     
 }
コード例 #18
0
ファイル: Engine.cs プロジェクト: klimentt/Telerik-Academy
 public virtual void AddObject(GameObject obj)
 {
     if (obj is MovingObject)
     {
         this.AddMovingObject(obj as MovingObject);
     }
     else
     {
         if (obj is Racket)
         {
             // TASK 3
             this.allObjects.RemoveAll(gameObject => gameObject is Racket);
             AddRacket(obj);
         }
         else
         {
             this.AddStaticObject(obj);
         }
     }
 }
コード例 #19
0
ファイル: Engine.cs プロジェクト: Varbanov/TelerikAcademy
 public virtual void AddObject(GameObject obj)
 {
     if (obj is MovingObject)
     {
         this.AddMovingObject(obj as MovingObject);
     }
     else
     {
         if (obj is Racket)
         {
             //03.Search for a "TODO" in the Engine class, regarding the AddRacket method. Solve the problem mentioned there. 
             //There should always be only one Racket. Note: comment in TODO not completely correct
             this.allObjects.RemoveAll(allObj => allObj is Racket);
             //END 03
             AddRacket(obj);
         }
         else
         {
             this.AddStaticObject(obj);
         }
     }
 }
コード例 #20
0
ファイル: InheritedEngine.cs プロジェクト: PetarPenev/Telerik
 protected override void AddRacket(GameObject obj)
 {
     bool check = true, secondCheck=true;
     ShootingRacket l;
     foreach (var c in this.allObjects)
     {
         if ((c is Racket) && !(c is ShootingRacket))
             check = false;
         else if (c is ShootingRacket)
             secondCheck = false;
     }
     if (check)
     {
         this.playerRacket = obj as Racket;
         this.AddStaticObject(obj);
     }
     else if (!secondCheck)
     {
         this.playerRacket = obj as ShootingRacket;
         this.AddStaticObject(obj);
     }
 }
コード例 #21
0
        public virtual void AddObject(GameObject obj)
        {
            if (obj is MovingObject)
            {
                this.AddMovingObject(obj as MovingObject);

                if (obj is Ball)
                {
                    this.ball = obj as Ball;
                }
            }
            else
            {
                if (obj is Racket)
                {
                    AddRacket(obj);

                }
                else
                {
                    this.AddStaticObject(obj);
                }
            }
        }
コード例 #22
0
        private void AddRacket(GameObject obj)
        {
            //03. Search for a "TODO" in the Engine class, regarding the AddRacket method. Solve the problem mentioned
            //    there. There should always be only one Racket. Note: comment in TODO not completely correct
            // TODO: we should remove the previous racket from this.allObjects
            //================================================================================================== Task 03>
            // obj is added to staticObjects AND allObjects (AddStaticObject(obj)), which means it should be removed from both
            this.allObjects.RemoveAll(x => x is Racket);
            this.staticObjects.RemoveAll(x => x is Racket);
            //================================================================================================== >Task 03

            this.playerRacket = obj as Racket;
            this.AddStaticObject(obj);
        }
コード例 #23
0
ファイル: Engine.cs プロジェクト: jamaldt/telerikacademy
 private void AddRacket(GameObject obj)
 {
     foreach (var item in allObjects)
     {
         if (item is Racket)
         {
             allObjects.Remove(item);
             break;
         }
     }
     foreach (var item in staticObjects)
     {
         if (item is Racket)
         {
             staticObjects.Remove(item);
             break;
         }
     }
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #24
0
ファイル: Engine.cs プロジェクト: diagara/Telerik-Academy
 private void RemoveRacket(GameObject obj)
 {
     this.playerRacket = obj as Racket;
     this.allObjects.RemoveAll(racketObject => racketObject is Racket);
 }
コード例 #25
0
ファイル: Engine.cs プロジェクト: diagara/Telerik-Academy
 private void AddRacket(GameObject obj)
 {
     this.RemoveRacket(playerRacket);
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #26
0
ファイル: Engine.cs プロジェクト: KirilToshev/Projects
 private void AddRacket(GameObject obj)
 {
     //TODO: we should remove the previous racket from this.allObjects
     //Removing previous rackets form staticObjects and allObjects
     for (int index = 0; index < allObjects.Count; index++)
     {
         if (allObjects[index].GetType().Name == typeof(Racket).Name)
         {
             this.allObjects.RemoveAt(index);
             break;
         }
     }
     for (int index = 0; index < staticObjects.Count; index++)
     {
         if (staticObjects[index].GetType().Name == typeof(Racket).Name)
         {
             this.staticObjects.RemoveAt(index);
             break;
         }
     }
     this.playerRacket = obj as Racket;
     this.AddStaticObject(obj);
 }
コード例 #27
0
ファイル: Engine.cs プロジェクト: NikolayGenov/TelerikAcademy
 private void AddRacket(GameObject obj)
 {
     this.playerRacket = obj as Racket;
     //Task 3
     //Find and the remove from all the object the previous racket
     this.allObjects.RemoveAll((pos) => pos is Racket);
     //End of Task 3
     this.AddStaticObject(obj);
 }
コード例 #28
0
ファイル: Engine.cs プロジェクト: VelizarIT/TelerikAcademy
 private void AddStaticObject(GameObject obj)
 {
     this.staticObjects.Add(obj);
     this.allObjects.Add(obj);
 }
コード例 #29
0
ファイル: Engine.cs プロジェクト: VelizarIT/TelerikAcademy
 private void AddRacket(GameObject obj)
 {
     this.playerRacket = obj as Racket;
     this.allObjects.RemoveAll(x => x is Racket);
     this.AddStaticObject(obj);
 }
コード例 #30
0
ファイル: Engine.cs プロジェクト: Dyno1990/TelerikAcademy-1
 private void AddRacket(GameObject obj)
 {
     //TODO: we should remove the previous racket from this.allObjects
     this.playerRacket = obj as Racket;
     staticObjects.Add(playerRacket);
 }