Пример #1
0
        void Engine_Collision(string arg1, string arg2)
        {
            var side1 = new CollisionSide {
                ObjectId = arg1
            };
            var side2 = new CollisionSide {
                ObjectId = arg2
            };

            FindControllableObject(side1);
            FindControllableObject(side2);

            if (cases.Any(z => z.Offender.Match(side1) && z.Victim.Match(side2)))
            {
                return;
            }
            cases.Add(new CollisionCase {
                Offender = side1, Victim = side2
            });
            cases.Add(new CollisionCase {
                Offender = side2, Victim = side1
            });
            if (!triggerSet)
            {
                triggerSet = true;
                world.Clocks.AddTrigger(new OneTimeTrigger(world.Clocks.CurrentTime + CooldownTime, Resolve));
            }
        }
Пример #2
0
 public bool Match(CollisionSide side)
 {
     if (IsControllable != side.IsControllable) return false;
     if (IsControllable)
         return ControllerId == side.ControllerId;
     return ObjectId == side.ObjectId;
 }
Пример #3
0
 public bool Match(CollisionSide side)
 {
     if (IsControllable != side.IsControllable)
     {
         return(false);
     }
     if (IsControllable)
     {
         return(ControllerId == side.ControllerId);
     }
     return(ObjectId == side.ObjectId);
 }
Пример #4
0
        void Engine_Collision(string arg1, string arg2)
        {
            var side1 = new CollisionSide { ObjectId = arg1 };
            var side2 = new CollisionSide { ObjectId = arg2 };
            FindControllableObject(side1);
            FindControllableObject(side2);

            if (cases.Any(z => z.Offender.Match(side1) && z.Victim.Match(side2)))
                return;
            cases.Add(new CollisionCase { Offender = side1, Victim = side2 });
            cases.Add(new CollisionCase { Offender = side2, Victim = side1 });
            if (!triggerSet)
            {
                triggerSet = true;
                world.Clocks.AddTrigger(new OneTimeTrigger(world.Clocks.CurrentTime + CooldownTime, Resolve));
            }
        }