Exemplo n.º 1
0
        public void Init()
        {
            motionSimulation = new ThreadSimulationProxy(new Simulation());

            //var npc = new NPC() { ID = "Villain" };
            //motionSimulation.Insert(npc);
            //unit1 = new ThreadUnitProxy(new Unit { ID = "Unit1" }, motionSimulation);
            var us = new Simulation().CreateUnit();
            ((Unit)us).ID = "Unit1";

            unit1 = motionSimulation.CreateUnit(us);
            unit1.IntersectsUnit += new EventHandler<IObjectArgs<IUnit>>(unit1_IntersectsUnit);
            //unit1.IntersectsUnit -= new EventHandler<IObjectArgs<IUnit>>(unit1_IntersectsUnit);
            //unit1.IntersectsUnit += (sender, unit) =>
            //{
            //    DebugOutput("UNITS INTERSECTED");
            //};
            //unit1.IntersectsUnit -= (sender, unit) =>
            //{
            //    DebugOutput("UNITS INTERSECTED");
            //};
            motionSimulation.Insert(unit1);

            //var projectile = new Projectile();
            //projectile.HitsObject += new Action<Object>((o) =>
            //{
            //    DebugOutput("Projectile hit " + ((Unit)o).ID);
            //});
            //motionSimulation.Insert(projectile);
        }
Exemplo n.º 2
0
        public void Init()
        {
            motionSimulation = new ThreadSimulationProxy(new Simulation());

            //var npc = new NPC() { ID = "Villain" };
            //motionSimulation.Insert(npc);
            //unit1 = new ThreadUnitProxy(new Unit { ID = "Unit1" }, motionSimulation);
            var us = new Simulation().CreateUnit();

            ((Unit)us).ID = "Unit1";

            unit1 = motionSimulation.CreateUnit(us);
            unit1.IntersectsUnit += new EventHandler <IObjectArgs <IUnit> >(unit1_IntersectsUnit);
            //unit1.IntersectsUnit -= new EventHandler<IObjectArgs<IUnit>>(unit1_IntersectsUnit);
            //unit1.IntersectsUnit += (sender, unit) =>
            //{
            //    DebugOutput("UNITS INTERSECTED");
            //};
            //unit1.IntersectsUnit -= (sender, unit) =>
            //{
            //    DebugOutput("UNITS INTERSECTED");
            //};
            motionSimulation.Insert(unit1);

            //var projectile = new Projectile();
            //projectile.HitsObject += new Action<Object>((o) =>
            //{
            //    DebugOutput("Projectile hit " + ((Unit)o).ID);
            //});
            //motionSimulation.Insert(projectile);
        }
 public ThreadUnitProxy(IUnit objectInstance, ThreadSimulationProxy simulation) : base(objectInstance, simulation)
 {
     this.objectInstance            = objectInstance;
     this.simulation                = simulation;
     objectInstance.IntersectsUnit += new EventHandler <IObjectArgs <IUnit> >(objectInstance_IntersectsUnit);
 }
 public ThreadObjectProxy(IObject objectInstance, ThreadSimulationProxy simulation)
 {
     this.objectInstance = objectInstance;
     this.simulation     = simulation;
 }
 public ThreadUnitProxy(IUnit objectInstance, ThreadSimulationProxy simulation)
     : base(objectInstance, simulation)
 {
     this.objectInstance = objectInstance;
     this.simulation = simulation;
     objectInstance.IntersectsUnit += new EventHandler<IObjectArgs<IUnit>>(objectInstance_IntersectsUnit);
 }
 public ThreadObjectProxy(IObject objectInstance, ThreadSimulationProxy simulation)
 {
     this.objectInstance = objectInstance;
     this.simulation = simulation;
 }