public void AddActor(ActorBase actor)
        {
            IBaseComponentContainer container = actor as IBaseComponentContainer;
            var init = container.GetInitData();

            //actor.CreateBody(factory.CreateRectangleBody(init.point_x, init.point_y, 10, 10));

            //判断是否是激光
            if (actor.GetActorType() != ActorTypeBaseDefine.ContinuousLaserActor && actor.GetActorType() != ActorTypeBaseDefine.PowerLaserActor)
            {
                actor.CreateBody(factory.CreateSpaceWonderBody(new Vector2(init.point_x, init.point_y), init.angle, actor.GetGameModelByActorType(), new UserData(actor.GetActorID(), actor.GetActorType())));
            }
            //是持续激光
            else if (actor.GetActorType() == ActorTypeBaseDefine.ContinuousLaserActor)
            {
                //获取长宽属性
                var WH = ActorHelper.GetLaserShapeByShip(actor.GetActorType());
                actor.CreateBody(factory.CreateSpaceWonderLaser(new Vector2(init.point_x, init.point_y), init.angle, new UserData(actor.GetActorID(), actor.GetActorType()), WH.X, WH.Y));
            }
            //是蓄力激光
            else if (actor.GetActorType() == ActorTypeBaseDefine.PowerLaserActor)
            {
                var WH = ActorHelper.GetLaserShapeByShip(actor.GetActorType(), heightpro: actor.GetActorInitPro());

                //Log.Trace("AddActor: actorID" + actor.GetActorID() + " InitDate" + init.point_x + " " + init.point_y + " " + init.angle + " WeaponDemage:" + ((IWeaponBaseComponentContainer)actor).GetWeaponDamage() + " WH" + WH.X + " " + WH.Y + " InitPro:" + actor.GetActorInitPro());

                actor.CreateBody(factory.CreateSpaceWonderLaser(new Vector2(init.point_x, init.point_y), init.angle, new UserData(actor.GetActorID(), actor.GetActorType()), WH.X, WH.Y));
            }
            //Log.Trace("AddActor: actorID" + actor.GetActorID() + " InitDate" + init.point_x + " " + init.point_y + " " + init.angle);
            //Log.Trace("actor id" + actor.GetActorID() + " 生成一个Actor Position:" + actor.GetPosition() + " Forward:" + actor.GetForward());

            _actorList.Add(actor);
        }
 public EliteShipAAiComponent(EliteShipAAiComponent clone, IBaseComponentContainer container) : base(clone, container)
 {
     level       = container.GetLevel();
     delytime    = clone.delytime;
     initnum     = clone.initnum;
     currenttime = DateTime.Now.Ticks;
 }
 public EliteShipAAiComponent(IBaseComponentContainer container, int delytime, int initnum) : base(container)
 {
     level         = container.GetLevel();
     this.delytime = delytime;
     this.initnum  = initnum;
     currenttime   = DateTime.Now.Ticks;
 }
        public static void RingDetection(this IBaseComponentContainer body, IBaseComponentContainer actor)
        {
            var body1 = body.GetPhysicalinternalBase().GetBody();
            var nose  = body1.GetSpaceShipNosePosition(body.GetGameModelByActorType());

            //var height =
            actor.GetPhysicalinternalBase().GetBody().SetTransform(nose, body.GetForwardAngle());
        }
        public static void Detection(this IBaseComponentContainer body, IBaseContainer actor)
        {
            var body1  = body.GetPhysicalinternalBase().GetBody();
            var nose   = body1.GetSpaceShipNosePosition(body.GetGameModelByActorType());
            var result = nose;

            actor.SetInitData(result.X, result.Y, body.GetForwardAngle());
        }
        public void RemoveActor(ActorBase actor)
        {
            IBaseComponentContainer container = actor as IBaseComponentContainer;
            var body = container.GetPhysicalinternalBase().GetBody();

            //TODO 从世界去除
            _world.DestroyBody(body);
            _actorList.Remove(actor);
        }
예제 #7
0
 public AIComponentBase Clone(IBaseComponentContainer container)
 {
     return(aIComponentBase.Clone(container));
 }
 public BlackHoleAiComponent(BlackHoleAiComponent clone, IBaseComponentContainer container) : base(clone, container)
 {
     level         = container.GetLevel();
     attractRadius = clone.attractRadius;
     attractForce  = clone.attractForce;
 }
 protected AIComponentBase(AIComponentBase clone, IBaseComponentContainer container)
 {
     this.container = container;
     this.isPause   = clone.isPause;
 }
예제 #10
0
 public override AIComponentBase Clone(IBaseComponentContainer container)
 {
     return(new DeadAiComponent(this, container));
 }
 public override AIComponentBase Clone(IBaseComponentContainer container)
 {
     return(new FollowAiComponent(this, container as IWeaponBaseComponentContainer));
 }
 public override AIComponentBase Clone(IBaseComponentContainer container)
 {
     return(new ShipEnemyAiComponent(this, container as IShipComponentBaseContainer));
 }
예제 #13
0
 public abstract AIComponentBase Clone(IBaseComponentContainer container);
예제 #14
0
 public virtual void Dispose()
 {
     container = null;
     isPause   = true;
 }
예제 #15
0
 public DeadAiComponent(long time, IBaseComponentContainer container) : base(container)
 {
     inittime  = DateTime.Now.Ticks;
     this.time = time;
 }
예제 #16
0
 public DeadAiComponent(DeadAiComponent clone, IBaseComponentContainer container) : base(clone, container)
 {
     inittime  = DateTime.Now.Ticks;
     this.time = clone.time;
 }
예제 #17
0
 public GogogoAiComponent(IBaseComponentContainer container, float aiforce) : base(container)
 {
     this.aiforce = aiforce;
 }
예제 #18
0
 public GogogoAiComponent(GogogoAiComponent clone, IBaseComponentContainer container) : base(clone, container)
 {
     this.aiforce = clone.aiforce;
 }
 public BlackHoleAiComponent(IBaseComponentContainer container, float attractradius, float attractforce) : base(container)
 {
     level         = container.GetLevel();
     attractRadius = attractradius;
     attractForce  = attractforce;
 }
예제 #20
0
 AIComponentBase IAIBase.Clone(IBaseComponentContainer container)
 {
     return(_aiComponent.Clone(container));
 }
예제 #21
0
 protected AIComponentBase(IBaseComponentContainer container)
 {
     this.container = container;
 }