コード例 #1
0
        public void NextSprite(int aX, int aY)
        {
            switch (AnimKind)
            {
            case AnimationKind.Direction:
                ImageIndex = ImagesOrigin + (Dir - 1);
                break;

            case AnimationKind.Rotation:
            {
                int fnum;
                if (ImageIndex == 0)
                {
                    fnum = 1;
                }
                else
                {
                    fnum = ImageIndex - ImagesOrigin + 1;
                }

                if (fnum == FramesCount)
                {
                    fnum = 1;
                }
                else
                {
                    fnum++;
                }
                ImageIndex = ImagesOrigin + (fnum - 1);
            }
            break;
            }

            SetPos(aX, aY);

            NWGameSpace space = (NWGameSpace)fSpace;

            if (space.Player.IsSeen(aX, aY, false))
            {
                space.RepaintView(25);
            }
        }
コード例 #2
0
        private void LineProc(int x, int y, ref bool refContinue)
        {
            Steps++;
            NWGameSpace space = Creature.Space;

            if (!Map.IsValid(x, y))
            {
                bool gpChanged = false;

                int fx = Map.Coords.X;
                int fy = Map.Coords.Y;
                int px = x;
                int py = y;

                GlobalPosition gpi = new GlobalPosition(fx, fy, px, py, gpChanged);
                gpi.CheckPos();
                fx        = gpi.Fx;
                fy        = gpi.Fy;
                px        = gpi.Px;
                py        = gpi.Py;
                gpChanged = gpi.GlobalChanged;

                NWLayer layer = Map.Layer;
                if (fx >= 0 && fx != layer.W && fy >= 0 && fy != layer.H && gpChanged)
                {
                    Map.Items.Extract(ProjectileItem);
                    Map = space.GetField(Creature.LayerID, fx, fy);
                    Map.Items.Add(ProjectileItem, false);
                    ProjectileItem.SetPos(px, py);
                }

                refContinue = false;
            }
            else
            {
                if (Map.IsBarrier(x, y))
                {
                    Hit         = HIT_BARRIER;
                    refContinue = false;
                }
                else if (Steps > Range)
                {
                    Hit         = HIT_NONE;
                    refContinue = false;
                }
                else
                {
                    NWCreature target = (NWCreature)Map.FindCreature(x, y);

                    if (target != null && !target.Equals(Creature))
                    {
                        Creature.AttackTo(Kind, target, Weapon, ProjectileItem);
                        ProjectileItem.SetPos(x, y);
                        Hit = HIT_BODY;

                        ProjectileItem.ApplyEffects(target, InvokeMode.im_Use, null);

                        refContinue = false;
                    }

                    if (refContinue)
                    {
                        ProjectileItem.SetPos(x, y);
                    }
                }
            }

            if (space.Player.IsSeen(x, y, false))
            {
                space.RepaintView(25);
            }
        }