コード例 #1
0
        public PistolBullet(BaseGameObject parent) : base(GameObjectType.Projectile, parent)
        {
            Size  bulletSize     = new Size(30, 30);
            Coord startBulletPos = (Coord)parent.GetComponent <SolidBody>().Pos.Clone();

            startBulletPos.x += parent.GetComponent <SolidBody>().Size.width / 2 - bulletSize.width / 2;
            startBulletPos.y += parent.GetComponent <SolidBody>().Size.height / 2 - bulletSize.height / 2;

            components.Add(new SolidBody(this,
                                         startBulletPos,
                                         bulletSize,
                                         parent.GetComponent <SolidBody>().Angle,
                                         true,
                                         TextureId.PistolBullet,
                                         Parent
                                         ));

            components.Add(new Projectile(this, 5));


            components.Add(new DealDMGOnCollide(this, 110, true, Parent));

            components.Add(new DieOnCollide(this, Parent));
            components.Add(new DieOnTTL(this, 100));

            components.Add(new DieableByDieMessage(this));
        }
コード例 #2
0
        protected BaseGameObject(GameObjectType goType, BaseGameObject parent)
        {
            messageQueue = new ConcurrentQueue <IComponentMessage>();
            components   = new List <IComponent>();
            Id           = ++lastId;
            isDisposed   = false;
            IsUpdated    = false;

            this.GOType = goType;
            this.Parent = parent;
        }