Esempio n. 1
0
        public override void OnUpdate()
        {
            if (Owner.Get() == null || lifetime <= 0)
            {
                Decorative.Remove(this);
                return;
            }

            if (rof-- > 0 && --lifetime > 0)
            {
                return;
            }
            rof = 5;

            int damage = lifetime > 0 ? 10 : 100;

            TechnoExt target = Decorative as TechnoExt;

            Pointer <WeaponTypeClass> pWeapon = Weapon;
            Pointer <BulletClass>     pBullet = pWeapon.Ref.Projectile.Ref.
                                                CreateBullet(target.OwnerObject.Convert <AbstractClass>(), Owner.Get().OwnerObject,
                                                             damage, Warhead, pWeapon.Ref.Speed, pWeapon.Ref.Bright);

            const int   radius      = 600;
            CoordStruct curLocation = target.OwnerObject.Ref.Base.Base.GetCoords();

            CoordStruct where = curLocation + new CoordStruct(random.Next(-radius, radius), random.Next(-radius, radius), 2000);
            BulletVelocity velocity = new BulletVelocity(0, 0, 0);

            pBullet.Ref.MoveTo(where, velocity);
        }
Esempio n. 2
0
        public override void OnUpdate()
        {
            Pointer <BulletClass> pBullet = Owner.OwnerObject;
            BulletTypeExt         extType = Owner.Type;

            CoordStruct nextLocation = pBullet.Ref.Base.Base.GetCoords();

            nextLocation.Z += 0;
            if (lastLocation == default(CoordStruct))
            {
                lastLocation = nextLocation;
            }
            if (lastLocation.DistanceFrom(nextLocation) > 50)
            {
                Pointer <LaserDrawClass> pLaser = YRMemory.Create <LaserDrawClass>(lastLocation, nextLocation, innerColor, outerColor, outerSpread, 50);
                pLaser.Ref.Thickness    = 6;
                pLaser.Ref.IsHouseColor = true;
                //Logger.Log("laser [({0}, {1}, {2}) -> ({3}, {4}, {5})]", lastLocation.X, lastLocation.Y, lastLocation.Z, nextLocation.X, nextLocation.Y, nextLocation.Z);

                lastLocation = nextLocation;
            }

            const int radius = 100;

            pBullet.Ref.Base.Location +=
                new CoordStruct((int)(Math.Cos(angle * Math.PI / 180) * radius), (int)(Math.Sin(angle * Math.PI / 180) * radius), 100)
                * (pBullet.Ref.Velocity.Z > -20 ? 1 : -1);
            angle = (angle + 25) % 360;
        }
Esempio n. 3
0
        public override void OnUpdate()
        {
            if (Owner.Get() == null || lifetime <= 0)
            {
                Decorative.Remove(this);
                return;
            }

            if (rof-- > 0 && --lifetime > 0)
            {
                return;
            }
            rof = 5;

            int damage = lifetime > 0 ? 10 : 100;

            TechnoExt target = Decorative as TechnoExt;

            Pointer <WeaponTypeClass>  pWeapon  = Weapon;
            Pointer <WarheadTypeClass> pWarhead = Warhead;

            Func <int, Pointer <BulletClass> > CreateBullet = (int damage) => {
                Pointer <BulletClass> pBullet = pWeapon.Ref.Projectile.Ref.
                                                CreateBullet(target.OwnerObject.Convert <AbstractClass>(), Owner.Get().OwnerObject,
                                                             damage, pWarhead, pWeapon.Ref.Speed, pWeapon.Ref.Bright);
                return(pBullet);
            };

            CoordStruct curLocation = target.OwnerObject.Ref.Base.Base.GetCoords();

            if (Cluster)
            {
                CellStruct cur = MapClass.Coord2Cell(curLocation);

                CellSpreadEnumerator enumerator = new CellSpreadEnumerator(2);
                foreach (CellStruct offset in enumerator)
                {
                    Pointer <BulletClass> pBullet = CreateBullet(damage);
                    CoordStruct where = MapClass.Cell2Coord(cur + offset, 2000);
                    if (MapClass.Instance.TryGetCellAt(where, out Pointer <CellClass> pCell))
                    {
                        BulletVelocity velocity = new BulletVelocity(0, 0, 0);
                        pBullet.Ref.MoveTo(where, velocity);
                        pBullet.Ref.SetTarget(pCell.Convert <AbstractClass>());
                    }
                }
            }
            else
            {
                Pointer <BulletClass> pBullet = CreateBullet(damage);

                const int radius = 600;
                CoordStruct where = curLocation + new CoordStruct(random.Next(-radius, radius), random.Next(-radius, radius), 2000);
                BulletVelocity velocity = new BulletVelocity(0, 0, 0);
                pBullet.Ref.MoveTo(where, velocity);
            }
        }
Esempio n. 4
0
        public virtual bool Put(CoordStruct XYZ)
        {
            Location = XYZ;
            InLimbo  = false;
            IsSensed = false;

            var xy = XYZ.ToCell();

            MapClass.Instance.GetCellAt(xy).AddContent(this);

            return(true);
        }
Esempio n. 5
0
        public virtual bool Put(CoordStruct XYZ)
        {
            Location = XYZ;
            InLimbo = false;
            IsSensed = false;

            var xy = XYZ.ToCell();

            MapClass.Instance.GetCellAt(xy).AddContent(this);

            return true;
        }
        public override void OnUpdate()
        {
            Pointer <BulletClass> pBullet = Owner.OwnerObject;
            BulletTypeExt         extType = Owner.Type;

            CoordStruct location = pBullet.Ref.Base.Base.GetCoords();

            location += new CoordStruct(random.Next(100, 500), random.Next(100, 500), random.Next(100, 500));

            Pointer <AnimClass> pLaser = YRMemory.Create <AnimClass>(pAnimType, location);

            pBullet.Ref.Velocity.Z = 70 * factor;
            factor = factor - 0.02;
        }
Esempio n. 7
0
        private void KillUpdate()
        {
            if (Target.TryGet(out TechnoExt ext))
            {
                Pointer <TechnoClass> pTechno = ext.OwnerObject;
                TechnoTypeExt         extType = ext.Type;

                CoordStruct curLocation = pTechno.Ref.Base.Base.GetCoords();

                int height = pTechno.Ref.Base.GetHeight();

                Action <int, int> Attack = (int start, int count) => {
                    int         increasement = 360 / count;
                    CoordStruct from         = curLocation;
                    from.Z += 5000;
                    for (int i = 0; i < count; i++)
                    {
                        double      x  = radius * Math.Cos((start + i * increasement) * Math.PI / 180);
                        double      y  = radius * Math.Sin((start + i * increasement) * Math.PI / 180);
                        CoordStruct to = curLocation + new CoordStruct((int)x, (int)y, -height);
                        Pointer <LaserDrawClass> pLaser = YRMemory.Create <LaserDrawClass>(from, to, innerColor, outerColor, outerSpread, 8);
                        pLaser.Ref.Thickness    = 10;
                        pLaser.Ref.IsHouseColor = true;

                        if (frames > 300)
                        {
                            int damage = 11;
                            // MapClass.DamageArea(to, damage, Owner.OwnerObject, pWH, false, Owner.OwnerObject.Ref.Owner);
                            // MapClass.FlashbangWarheadAt(damage, pWH, to);
                            Pointer <BulletClass> pBullet = pBulletType.Ref.CreateBullet(pTechno.Convert <AbstractClass>(), Owner.OwnerObject, damage, pWH, 100, true);
                            pBullet.Ref.Detonate(to);
                        }
                        else
                        {
                            frames++;
                        }
                    }
                };

                Attack(angle, 5);
                angle   = (angle + 4) % 360;
                radius -= 11;
                if (radius < 0)
                {
                    KillStart(ext);
                }
            }
        }
Esempio n. 8
0
        public override void OnUpdate()
        {
            Pointer <TechnoClass> pTechno = Owner.OwnerObject;
            TechnoTypeExt         extType = Owner.Type;

            CoordStruct nextLocation = pTechno.Ref.Base.Base.GetCoords();

            nextLocation.Z += 50;
            if (lastLocation.DistanceFrom(nextLocation) > 100)
            {
                Pointer <LaserDrawClass> pLaser = YRMemory.Create <LaserDrawClass>(lastLocation, nextLocation, innerColor, outerColor, outerSpread, 30);
                pLaser.Ref.Thickness    = 10;
                pLaser.Ref.IsHouseColor = true;
                //Logger.Log("laser [({0}, {1}, {2}) -> ({3}, {4}, {5})]", lastLocation.X, lastLocation.Y, lastLocation.Z, nextLocation.X, nextLocation.Y, nextLocation.Z);

                lastLocation = nextLocation;
            }
        }
Esempio n. 9
0
 public virtual void OnPut(CoordStruct coord, Direction faceDir)
 {
 }