コード例 #1
0
        public HalfLozenge(byte minRadius, byte radius, DirectionsEnum direction = DirectionsEnum.DIRECTION_NORTH)
        {
            MinRadius = minRadius;
            Radius = radius;

            Direction = direction;
        }
コード例 #2
0
ファイル: DirectionFlagEnum.cs プロジェクト: Mixi59/Stump
        public static DirectionFlagEnum GetFlag(this DirectionsEnum direction)
        {
            switch (direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
                return(DirectionFlagEnum.DIRECTION_EAST);

            case DirectionsEnum.DIRECTION_WEST:
                return(DirectionFlagEnum.DIRECTION_WEST);

            case DirectionsEnum.DIRECTION_NORTH:
                return(DirectionFlagEnum.DIRECTION_NORTH);

            case DirectionsEnum.DIRECTION_SOUTH:
                return(DirectionFlagEnum.DIRECTION_SOUTH);

            case DirectionsEnum.DIRECTION_NORTH_EAST:
                return(DirectionFlagEnum.DIRECTION_NORTH_EAST);

            case DirectionsEnum.DIRECTION_NORTH_WEST:
                return(DirectionFlagEnum.DIRECTION_NORTH_WEST);

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
                return(DirectionFlagEnum.DIRECTION_SOUTH_EAST);

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
                return(DirectionFlagEnum.DIRECTION_SOUTH_WEST);

            default:
                return(DirectionFlagEnum.NONE);
            }
        }
コード例 #3
0
        private Position CalculateFuturePosition(Position currentPosition, DirectionsEnum direction)
        {
            var newPosition = new Position();

            switch (direction)
            {
            case DirectionsEnum.East:
                newPosition.X = currentPosition.X + MovingSpeed;
                newPosition.Y = currentPosition.Y;
                break;

            case DirectionsEnum.North:
                newPosition.X = currentPosition.X;
                newPosition.Y = currentPosition.Y - MovingSpeed;
                break;

            case DirectionsEnum.South:
                newPosition.X = currentPosition.X;
                newPosition.Y = currentPosition.Y + MovingSpeed;
                break;

            case DirectionsEnum.West:
                newPosition.X = currentPosition.X - MovingSpeed;
                newPosition.Y = currentPosition.Y;
                break;
            }

            return(newPosition);
        }
コード例 #4
0
        public HalfLozenge(byte minRadius, byte radius, DirectionsEnum direction = DirectionsEnum.DIRECTION_NORTH)
        {
            MinRadius = minRadius;
            Radius    = radius;

            Direction = direction;
        }
コード例 #5
0
        public static short GetNearCellByDirection(short Cell1, DirectionsEnum Direction)
        {
            switch (Direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
                return((short)(Cell1 + 1));

            case DirectionsEnum.DIRECTION_WEST:
                return((short)(Cell1 - 1));

            case DirectionsEnum.DIRECTION_SOUTH:
                return((short)(Cell1 + 28));

            case DirectionsEnum.DIRECTION_NORTH:
                return((short)(Cell1 - 28));

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
                return((short)(Cell1 + 29));

            case DirectionsEnum.DIRECTION_NORTH_WEST:
                return((short)(Cell1 - 29));

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
                return((short)(Cell1 + 27));

            case DirectionsEnum.DIRECTION_NORTH_EAST:
                return((short)(Cell1 - 27));

            default:
                return(0);
            }
        }
コード例 #6
0
ファイル: Shot.cs プロジェクト: NegroniTeam/NegroniRPG
        public Shot(Vector2 playerPosition, DirectionsEnum currentDirection)
        {
            this.ShotTextures = GameScreen.Instance.ShotsTextures;
            this.ShotTexture = this.ShotTextures[0];
            this.direction = currentDirection;

            if (this.direction == DirectionsEnum.South)
            {
                this.shotPosition = new Vector2(playerPosition.X + 8, playerPosition.Y + 15);
                this.EndPoint = new Point((int)(shotPosition.X), (int)(shotPosition.Y + GameSettings.RANGE));
            }
            else if (this.direction == DirectionsEnum.North)
            {
                this.shotPosition = new Vector2(playerPosition.X + 8, playerPosition.Y - 8);
                this.EndPoint = new Point((int)(shotPosition.X), (int)(shotPosition.Y - GameSettings.RANGE));
            }
            else if (this.direction == DirectionsEnum.East)
            {
                this.shotPosition = new Vector2(playerPosition.X + 24, playerPosition.Y + 12);
                this.EndPoint = new Point((int)(shotPosition.X + GameSettings.RANGE), (int)(shotPosition.Y));
            }
            else if (this.direction == DirectionsEnum.West)
            {
                this.shotPosition = new Vector2(playerPosition.X - 8, playerPosition.Y + 12);
                this.EndPoint = new Point((int)(shotPosition.X - GameSettings.RANGE), (int)(shotPosition.Y));
            }

            GameScreen.Instance.FireAttackSound.Play();
        }
コード例 #7
0
        public static Vector2i GetIntDirection(DirectionsEnum dir)
        {
            switch (dir)
            {
            case DirectionsEnum.Up:
                return(UpInt);

            case DirectionsEnum.Down:
                return(DownInt);

            case DirectionsEnum.Left:
                return(LeftInt);

            case DirectionsEnum.Right:
                return(RightInt);

            case DirectionsEnum.DownLeft:
                return(DownLeftInt);

            case DirectionsEnum.DownRight:
                return(DownRightInt);

            case DirectionsEnum.UpLeft:
                return(UpLeftInt);

            case DirectionsEnum.UpRight:
                return(UpRightInt);
            }

            return(UpInt);
        }
コード例 #8
0
        public override bool Apply()
        {
            DirectionsEnum orientation = this.CastPoint.OrientationTo(this.TargetedPoint, true);
            FightActor     target      = this.Fight.GetFirstFighter <FightActor>((Predicate <FightActor>)(entry => (int)entry.Position.Cell.Id == (int)this.CastPoint.GetCellInDirection(orientation, (short)1).CellId));
            bool           flag;

            if (target == null)
            {
                flag = false;
            }
            else
            {
                Cell       startCell          = target.Cell;
                Cell       cell               = this.TargetedCell;
                MapPoint[] cellsOnLineBetween = new MapPoint(startCell).GetCellsOnLineBetween(this.TargetedPoint);
                for (int index = 0; index < cellsOnLineBetween.Length; ++index)
                {
                    MapPoint mapPoint = cellsOnLineBetween[index];
                    if (!this.Fight.IsCellFree(this.Fight.Map.Cells[(int)mapPoint.CellId]))
                    {
                        cell = index <= 0 ? startCell : this.Fight.Map.Cells[(int)cellsOnLineBetween[index - 1].CellId];
                    }
                    if (this.Fight.ShouldTriggerOnMove(this.Fight.Map.Cells[(int)mapPoint.CellId]))
                    {
                        cell = this.Fight.Map.Cells[(int)mapPoint.CellId];
                        break;
                    }
                }
                target.Cell = cell;
                this.Fight.ForEach((Action <Character>)(entry => ActionsHandler.SendGameActionFightSlideMessage((IPacketReceiver)entry.Client, this.Caster, target, startCell.Id, target.Cell.Id)));
                flag = true;
            }
            return(flag);
        }
コード例 #9
0
    private void ProcessDirectionInput()
    {
        DirectionsEnum currentDirection = DirectionsEnum.None;

        if (Input.GetKey(KeyCode.UpArrow))
        {
            currentDirection = DirectionsEnum.Up;
        }

        if (Input.GetKey(KeyCode.DownArrow))
        {
            currentDirection = DirectionsEnum.Down;
        }

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            currentDirection = DirectionsEnum.Left;
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            currentDirection = DirectionsEnum.Right;
        }

        foreach (var entity in _affectedEntities)
        {
            var move = entity.move;
            entity.ReplaceMove(move.speed, currentDirection, move.currentVelocity);
        }
    }
コード例 #10
0
        public Shot(Vector2 playerPosition, DirectionsEnum currentDirection)
        {
            this.ShotTextures = GameScreen.Instance.ShotsTextures;
            this.ShotTexture  = this.ShotTextures[0];
            this.direction    = currentDirection;

            if (this.direction == DirectionsEnum.South)
            {
                this.shotPosition = new Vector2(playerPosition.X + 8, playerPosition.Y + 15);
                this.EndPoint     = new Point((int)(shotPosition.X), (int)(shotPosition.Y + GameSettings.RANGE));
            }
            else if (this.direction == DirectionsEnum.North)
            {
                this.shotPosition = new Vector2(playerPosition.X + 8, playerPosition.Y - 8);
                this.EndPoint     = new Point((int)(shotPosition.X), (int)(shotPosition.Y - GameSettings.RANGE));
            }
            else if (this.direction == DirectionsEnum.East)
            {
                this.shotPosition = new Vector2(playerPosition.X + 24, playerPosition.Y + 12);
                this.EndPoint     = new Point((int)(shotPosition.X + GameSettings.RANGE), (int)(shotPosition.Y));
            }
            else if (this.direction == DirectionsEnum.West)
            {
                this.shotPosition = new Vector2(playerPosition.X - 8, playerPosition.Y + 12);
                this.EndPoint     = new Point((int)(shotPosition.X - GameSettings.RANGE), (int)(shotPosition.Y));
            }

            GameScreen.Instance.FireAttackSound.Play();
        }
コード例 #11
0
ファイル: RepelsTo.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        public override bool Apply(Fighter[] targets)
        {
            DirectionsEnum orientation = this.Source.Point.OrientationTo(CastPoint, true); //Source.Point=> this.TargetedPoint
            short          adjCellId   = this.Source.Point.GetCellInDirection(orientation, (short)1).CellId;

            Fighter target = this.Fight.GetFirstFighter <Fighter>(entry => (int)entry.CellId == adjCellId);

            if (target == null)
            {
                return(false);
            }
            else
            {
                MapPoint   startPoint         = target.Point;
                MapPoint   point              = CastPoint;
                MapPoint[] cellsOnLineBetween = startPoint.GetCellsOnLineBetween(CastPoint);
                for (int index = 0; index < cellsOnLineBetween.Length; ++index)
                {
                    MapPoint mapPoint = cellsOnLineBetween[index];
                    if (!this.Fight.IsCellFree(mapPoint.CellId))
                    {
                        point = index <= 0 ? startPoint : new MapPoint((short)cellsOnLineBetween[index - 1].CellId);
                    }
                    if (this.Fight.ShouldTriggerOnMove(mapPoint.CellId))
                    {
                        point = mapPoint;
                        break;
                    }
                }
                target.Slide(Source, point.CellId);
                return(true);
            }
        }
コード例 #12
0
        public override void Execute(TriggerBase trigger)
        {
            NpcTemplate    npcTemplate    = trigger.Get <NpcTemplate>("npc");
            ObjectPosition objectPosition = null;

            if (trigger.IsArgumentDefined("map") && trigger.IsArgumentDefined("cell") && trigger.IsArgumentDefined("direction"))
            {
                Map            map       = trigger.Get <Map>("map");
                short          cellId    = trigger.Get <short>("cell");
                DirectionsEnum direction = trigger.Get <DirectionsEnum>("direction");
                objectPosition = new ObjectPosition(map, cellId, direction);
            }
            else
            {
                if (trigger is GameTrigger)
                {
                    objectPosition = (trigger as GameTrigger).Character.Position;
                }
            }
            if (objectPosition == null)
            {
                trigger.ReplyError("Position of npc is not defined");
            }
            else
            {
                Npc npc = objectPosition.Map.SpawnNpc(npcTemplate, objectPosition, npcTemplate.Look);
                trigger.Reply("Npc {0} spawned", new object[]
                {
                    npc.Id
                });
            }
        }
コード例 #13
0
        protected override RunStatus Run(object context)
        {
            RunStatus result;

            if (!base.Fighter.CanMove())
            {
                result = RunStatus.Failure;
            }
            else
            {
                if (this.From == null)
                {
                    result = RunStatus.Failure;
                }
                else
                {
                    DirectionsEnum direction       = this.From.Position.Point.OrientationTo(base.Fighter.Position.Point, true);
                    MapPoint       cellInDirection = base.Fighter.Position.Point.GetCellInDirection(direction, (short)base.Fighter.MP);
                    if (cellInDirection == null)
                    {
                        result = RunStatus.Failure;
                    }
                    else
                    {
                        MoveAction moveAction = new MoveAction(base.Fighter, cellInDirection);
                        result = moveAction.YieldExecute(context);
                    }
                }
            }
            return(result);
        }
コード例 #14
0
ファイル: MoveFrame.cs プロジェクト: tuita520/RaidBot
        public void Move(DirectionsEnum direction, WorldControler world, short cellId)
        {
            mChangeMap   = true;
            MapDirection = direction;

            Move(GetRandomCellid(direction, world), cellId, true, world);
        }
コード例 #15
0
ファイル: MoveFrame.cs プロジェクト: tuita520/RaidBot
        private void ChangeMap(DirectionsEnum direction, Map map)
        {
            ChangeMapMessage message = new ChangeMapMessage();

            switch (direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
                message = new ChangeMapMessage(map.RightNeighbourId);
                break;

            case DirectionsEnum.DIRECTION_NORTH:
                message = new ChangeMapMessage(map.TopNeighbourId);
                break;

            case DirectionsEnum.DIRECTION_SOUTH:
                message = new ChangeMapMessage(map.BottomNeighbourId);

                break;

            case DirectionsEnum.DIRECTION_WEST:
                message = new ChangeMapMessage(map.LeftNeighbourId);
                break;
            }
            mHost.SendMessage(message);
        }
コード例 #16
0
        /*public static short GetPushedCell(short Cell1, byte Radius)
         * {
         *  for (int i = 0; i < Radius; i++)
         *  {
         *
         *  }
         * }*/

        #endregion

        #region Direction/nearcell

        public static short GetNearCell(short Cell1, DirectionsEnum Direction)
        {
            switch (Direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
                return((short)(Cell1 + 1));

            case DirectionsEnum.DIRECTION_WEST:
                return((short)(Cell1 - 1));

            case DirectionsEnum.DIRECTION_SOUTH:
                return((short)(Cell1 + 28));

            case DirectionsEnum.DIRECTION_NORTH:
                return((short)(Cell1 - 28));

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
                return((short)(Cell1 + (DiagonalsCells.ContainsKey(Cell1) ? 14 : 15)));

            case DirectionsEnum.DIRECTION_NORTH_WEST:
                return((short)(Cell1 - (DiagonalsCells.ContainsKey(Cell1) ? 15 : 14)));

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
                return((short)(Cell1 + (DiagonalsCells.ContainsKey(Cell1) ? 13 : 14)));

            case DirectionsEnum.DIRECTION_NORTH_EAST:
                return((short)(Cell1 - (DiagonalsCells.ContainsKey(Cell1) ? 14 : 13)));

            default:
                return(0);
            }
        }
コード例 #17
0
        public static DirectionsEnum GetOposedDirection(DirectionsEnum direction)
        {
            switch (direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
                return(DirectionsEnum.DIRECTION_WEST);

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
                return(DirectionsEnum.DIRECTION_NORTH_WEST);

            case DirectionsEnum.DIRECTION_SOUTH:
                return(DirectionsEnum.DIRECTION_NORTH);

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
                return(DirectionsEnum.DIRECTION_NORTH_EAST);

            case DirectionsEnum.DIRECTION_WEST:
                return(DirectionsEnum.DIRECTION_EAST);

            case DirectionsEnum.DIRECTION_NORTH_WEST:
                return(DirectionsEnum.DIRECTION_SOUTH_EAST);

            case DirectionsEnum.DIRECTION_NORTH:
                return(DirectionsEnum.DIRECTION_SOUTH);

            case DirectionsEnum.DIRECTION_NORTH_EAST:
                return(DirectionsEnum.DIRECTION_SOUTH_WEST);

            default:
                throw new Exception("What is dat direction dude?");
            }
        }
コード例 #18
0
        /// <summary>
        /// Give each cell (included the starting cell) of the path as input, and compute packed cell array for GameMapMovementRequestMessage.
        /// </summary>
        /// <param name="path">Minimum size = 2 (source and dest cells)</param>
        /// <returns></returns>
        public short[] PackPath(short[] path)
        {
            Debug.Assert(path.Length > 1); // At least source and dest cells
            List <short> PackedPath = new List <short>();

            if (path.Length < 2)
            {
                return(PackedPath.ToArray());
            }
            DirectionsEnum PreviousOrientation = DirectionsEnum.DIRECTION_EAST;
            DirectionsEnum Orientation         = DirectionsEnum.DIRECTION_EAST;
            short          PreviousCellId      = path[0];

            for (short NoCell = 1; NoCell < path.Length; NoCell++)
            {
                short cellid = path[NoCell];
                Debug.Assert(cellid >= 0 && cellid < CellInfo.NB_CELL);

                Orientation = GetOrientation(PreviousCellId, cellid);
                if (NoCell == 1 || (Orientation != PreviousOrientation) || NoCell == (path.Length - 1)) // Odd, but first step is always packed
                {
                    PackedPath.Add((short)((ushort)cellid | ((ushort)Orientation) << 12));
                    PreviousOrientation = Orientation;
                }

                PreviousCellId = cellid;
            }
            return(PackedPath.ToArray());
        }
コード例 #19
0
ファイル: TankView.cs プロジェクト: mithy/RetroTanks
    public void Rotate(DirectionsEnum direction)
    {
        switch (direction)
        {
        case DirectionsEnum.Up:
            _rotationNode.rotation = Quaternion.Euler(new Vector3(0, 0, 270));
            break;

        case DirectionsEnum.Down:
            _rotationNode.rotation = Quaternion.Euler(new Vector3(0, 0, 90));
            break;

        case DirectionsEnum.Left:
            _rotationNode.rotation = Quaternion.Euler(new Vector3(0, 0, 0));
            break;

        case DirectionsEnum.Right:
            _rotationNode.rotation = Quaternion.Euler(new Vector3(0, 0, 180));
            break;
        }

        if (direction != DirectionsEnum.None)
        {
            _currentFacingDirection = direction;
        }
    }
コード例 #20
0
 public Restrictions(List <Restriction> restrictions, DirectionsEnum direction)
 {
     InitializeComponent();
     this.restrictions   = restrictions;
     RestrictionBox.Text = String.Join(";", restrictions.Select <Restriction, string>(x => x.ReplicaId).ToArray());
     this.direction      = direction;
 }
コード例 #21
0
        public int GetCellInDirection(DirectionsEnum direction, short step)
        {
            Point ThatCell;

            switch (direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
            {
                ThatCell = new Point(Location.X + step, Location.Y + step);
                break;
            }

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
            {
                ThatCell = new Point(Location.X + step, Location.Y);
                break;
            }

            case DirectionsEnum.DIRECTION_SOUTH:
            {
                ThatCell = new Point(Location.X + step, Location.Y - step);
                break;
            }

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
            {
                ThatCell = new Point(Location.X, Location.Y - step);
                break;
            }

            case DirectionsEnum.DIRECTION_WEST:
            {
                ThatCell = new Point(Location.X - step, Location.Y - step);
                break;
            }

            case DirectionsEnum.DIRECTION_NORTH_WEST:
            {
                ThatCell = new Point(Location.X - step, Location.Y);
                break;
            }

            case DirectionsEnum.DIRECTION_NORTH:
            {
                ThatCell = new Point(Location.X - step, Location.Y + step);
                break;
            }

            case DirectionsEnum.DIRECTION_NORTH_EAST:
            {
                ThatCell = new Point(Location.X, Location.Y + step);
                break;
            }

            default:
                throw new Exception("Unknown direction : " + direction);
            }
            return(PathingUtils.CoordToCellId(ThatCell.X, ThatCell.Y));
        }
コード例 #22
0
    private void CreateProjectileEntity(Vector2 position, DirectionsEnum direction)
    {
        var entity = _gameContext.CreateEntity();

        entity.AddAsset(AssetsEnum.Projectile);
        entity.AddPosition(position.x, position.y);
        entity.AddMove(1.5f, direction, Vector2.zero);
    }
コード例 #23
0
ファイル: Cross.cs プロジェクト: Guiedo/BehaviorIsManaged
        public Cross(byte minRadius, byte radius, DirectionsEnum? direction = null)
        {
            MinRadius = minRadius;
            Radius = radius;

            DisabledDirections = new List<DirectionsEnum>();
            if (direction != null) Direction = direction.Value;
        }
コード例 #24
0
        public IEnumerable <Cell> GetArea(Cell origin, Cell dest)
        {
            DirectionsEnum direction = origin.OrientationTo(dest, true);
            Zone           zone      = new Zone(ZoneShape, (byte)ZoneSize, direction);

            zone.MinRadius = (byte)ZoneMinSize;
            return(zone.GetCells(dest, dest.Map));
        }
コード例 #25
0
        public ObjectPosition(Map map, Cell cell, DirectionsEnum direction)
        {
            if (map == null) throw new ArgumentNullException("map");
            if (cell == null) throw new ArgumentNullException("cell");

            Map = map;
            Cell = cell;
            Direction = direction;
        }
コード例 #26
0
 public TimedPathElement(Cell currentCell, Cell nextCell, DateTime startTime, DateTime endTime, double velocity, DirectionsEnum direction)
 {
     CurrentCell = currentCell;
     NextCell    = nextCell;
     StartTime   = startTime;
     EndTime     = endTime;
     Velocity    = velocity;
     Direction   = direction;
 }
コード例 #27
0
ファイル: Zone.cs プロジェクト: Mixi59/Stump
 public Zone(SpellShapeEnum shape, byte radius, byte minRadius, DirectionsEnum direction, int efficiencyMalus, int maxEfficiency)
 {
     Radius          = radius;
     MinRadius       = minRadius;
     Direction       = direction;
     ShapeType       = shape;
     EfficiencyMalus = efficiencyMalus > 0 ? efficiencyMalus : EFFECTSHAPE_DEFAULT_EFFICIENCY;
     MaxEfficiency   = maxEfficiency > 0 ? maxEfficiency : EFFECTSHAPE_DEFAULT_MAX_EFFICIENCY_APPLY;
 }
コード例 #28
0
    public void ReplaceFireInput(UnityEngine.Vector3 newPosition, DirectionsEnum newDirection)
    {
        var index     = InputComponentsLookup.FireInput;
        var component = CreateComponent <FireInputComponent>(index);

        component.position  = newPosition;
        component.direction = newDirection;
        ReplaceComponent(index, component);
    }
コード例 #29
0
 public TimedPathElement(Cell currentCell, Cell nextCell, DateTime startTime, DateTime endTime, double velocity, DirectionsEnum direction)
 {
     CurrentCell = currentCell;
     NextCell = nextCell;
     StartTime = startTime;
     EndTime = endTime;
     Velocity = velocity;
     Direction = direction;
 }
コード例 #30
0
        public MapPoint GetCellInDirection(DirectionsEnum direction, short step)
        {
            MapPoint mapPoint = null;

            switch (direction)
            {
            case DirectionsEnum.DIRECTION_EAST:
                mapPoint = MapPoint.GetPoint(this.m_x + (int)step, this.m_y + (int)step);
                break;

            case DirectionsEnum.DIRECTION_SOUTH_EAST:
                mapPoint = MapPoint.GetPoint(this.m_x + (int)step, this.m_y);
                break;

            case DirectionsEnum.DIRECTION_SOUTH:
                mapPoint = MapPoint.GetPoint(this.m_x + (int)step, this.m_y - (int)step);
                break;

            case DirectionsEnum.DIRECTION_SOUTH_WEST:
                mapPoint = MapPoint.GetPoint(this.m_x, this.m_y - (int)step);
                break;

            case DirectionsEnum.DIRECTION_WEST:
                mapPoint = MapPoint.GetPoint(this.m_x - (int)step, this.m_y - (int)step);
                break;

            case DirectionsEnum.DIRECTION_NORTH_WEST:
                mapPoint = MapPoint.GetPoint(this.m_x - (int)step, this.m_y);
                break;

            case DirectionsEnum.DIRECTION_NORTH:
                mapPoint = MapPoint.GetPoint(this.m_x - (int)step, this.m_y + (int)step);
                break;

            case DirectionsEnum.DIRECTION_NORTH_EAST:
                mapPoint = MapPoint.GetPoint(this.m_x, this.m_y + (int)step);
                break;
            }
            MapPoint result;

            if (mapPoint != null)
            {
                if (MapPoint.IsInMap(mapPoint.X, mapPoint.Y))
                {
                    result = mapPoint;
                }
                else
                {
                    result = null;
                }
            }
            else
            {
                result = null;
            }
            return(result);
        }
コード例 #31
0
ファイル: MoveFrame.cs プロジェクト: tuita520/RaidBot
        private short GetRandomCellid(DirectionsEnum direction, WorldControler world, bool passAcotrs = false)
        {
            try
            {
                switch (direction)
                {
                case DirectionsEnum.DIRECTION_SOUTH:
                    while (true)
                    {
                        Random al   = new Random();
                        int    dest = al.Next(532, 559);
                        if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs))
                        {
                            return((short)(dest));
                        }
                    }

                case DirectionsEnum.DIRECTION_NORTH:
                    while (true)
                    {
                        Random al   = new Random();
                        int    dest = al.Next(14, 27);
                        if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs))
                        {
                            return((short)(dest));
                        }
                    }

                case DirectionsEnum.DIRECTION_EAST:
                    while (true)
                    {
                        Random al   = new Random();
                        int    dest = al.Next(0, 39) * 14 + 13;
                        if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs))
                        {
                            return((short)(dest));
                        }
                    }

                case DirectionsEnum.DIRECTION_WEST:
                    while (true)
                    {
                        Random al   = new Random();
                        int    dest = al.Next(0, 39) * 14;
                        if (world.Map.Data.Cells[dest].mov && world.Map.Data.Cells[dest].mapChangeData != 0 && (!world.Map.Actors.ContainsKey(dest) && !passAcotrs))
                        {
                            return((short)(dest));
                        }
                    }
                }
            }
            catch (Exception e) {
                mHost.logger.Log("Impossible de changer la map vers cette direction", LogLevelEnum.Error);
            }
            return(GetRandomCellid(direction, world, true));
        }
コード例 #32
0
ファイル: MapPoint.cs プロジェクト: Zaetic/Symbioz-2.38-RED
        public MapPoint[] GetCellsInDirection(DirectionsEnum direction, short range)
        {
            MapPoint[] points = new MapPoint[range];

            for (short i = 1; i < range + 1; i++)
            {
                points[i - 1] = this.GetCellInDirection(direction, i);
            }
            return(points);
        }
コード例 #33
0
    public void ReplaceMove(float newSpeed, DirectionsEnum newDirection, UnityEngine.Vector2 newCurrentVelocity)
    {
        var index     = GameComponentsLookup.Move;
        var component = CreateComponent <MoveComponent>(index);

        component.speed           = newSpeed;
        component.direction       = newDirection;
        component.currentVelocity = newCurrentVelocity;
        ReplaceComponent(index, component);
    }
コード例 #34
0
 public override bool Apply()
 {
     EffectInteger effectInteger = this.GenerateEffect();
     bool flag;
     if (effectInteger == null)
     {
         flag = false;
     }
     else
     {
         foreach (FightActor target in this.GetAffectedActors())
         {
             if (target.CanBeMove())
             {
                 MapPoint point1 = this.TargetedCell.Id != target.Cell.Id ? this.TargetedPoint : new MapPoint(this.CastCell);
                 if (point1.CellId != target.Position.Cell.Id)
                 {
                     DirectionsEnum direction = target.Position.Point.OrientationTo(point1, false);
                     MapPoint point2 = target.Position.Point;
                     MapPoint mapPoint1 = point2;
                     for (int index = 0; index < effectInteger.Value; ++index)
                     {
                         MapPoint nearestCellInDirection = mapPoint1.GetNearestCellInDirection(direction);
                         if (nearestCellInDirection != null)
                         {
                             if (!this.Fight.ShouldTriggerOnMove(this.Fight.Map.Cells[nearestCellInDirection.CellId]))
                             {
                                 if (this.Fight.IsCellFree(this.Map.Cells[nearestCellInDirection.CellId]))
                                 {
                                     mapPoint1 = nearestCellInDirection;
                                 }
                                 else
                                 {
                                     break;
                                 }
                             }
                             else
                             {
                                 mapPoint1 = nearestCellInDirection;
                                 break;
                             }
                         }
                         else
                             break;
                     }
                     MapPoint mapPoint2 = mapPoint1;
                     target.Position.Cell = this.Map.Cells[(int)mapPoint2.CellId];
                     ActionsHandler.SendGameActionFightSlideMessage((IPacketReceiver)this.Fight.Clients, this.Caster, target, point2.CellId, mapPoint2.CellId);
                 }
             }
         }
         flag = true;
     }
     return flag;
 }
コード例 #35
0
ファイル: MovesManager.cs プロジェクト: ghosty3d/robodnacer
    public DirectionsEnum GetCurrentArrowDirection()
    {
        DirectionsEnum direction = DirectionsEnum.NONE;

        if (currentArrow != null)
        {
            direction = currentArrow.arrowDirection;
        }

        return(direction);
    }
コード例 #36
0
ファイル: Cell.cs プロジェクト: Guiedo/BehaviorIsManaged
 public IEnumerable<Cell> GetCellsInDirection(DirectionsEnum direction, short minDistance, short maxDistance)
 {
     for (short distance = minDistance; distance <= maxDistance; distance++)
     {
         Cell cell = GetCellInDirection(direction, distance);
         if (cell != null)
             yield return cell;
     }
 }
コード例 #37
0
ファイル: Line.cs プロジェクト: Ryuuke/BehaviorIsManaged
 public Line(byte radius, DirectionsEnum direction = DirectionsEnum.DIRECTION_SOUTH_EAST)
 {
     Radius = radius;
     Direction = direction;
 }
コード例 #38
0
 public PathElement(Cell cell, DirectionsEnum direction)
 {
     Cell = cell;
     Direction = direction;
 }
コード例 #39
0
ファイル: Cone.cs プロジェクト: Guiedo/BehaviorIsManaged
 public Cone(byte minRadius, byte radius, DirectionsEnum direction = DirectionsEnum.DIRECTION_SOUTH_EAST)
 {
     MinRadius = minRadius;
     Radius = radius;
     Direction = direction;
 }
コード例 #40
0
ファイル: PathHelper.cs プロジェクト: thomasvinot/Symbioz
        public static short GetNearCell(short Cell1, DirectionsEnum Direction)
        {
            switch (Direction)
            {
                case DirectionsEnum.DIRECTION_EAST:
                    return (short)(Cell1 + 1);

                case DirectionsEnum.DIRECTION_WEST:
                    return (short)(Cell1 - 1);

                case DirectionsEnum.DIRECTION_SOUTH:
                    return (short)(Cell1 + 28);

                case DirectionsEnum.DIRECTION_NORTH:
                    return (short)(Cell1 - 28);

                case DirectionsEnum.DIRECTION_SOUTH_EAST:
                    return (short)(Cell1 + (DiagonalsCells.ContainsKey(Cell1) ? 14 : 15));

                case DirectionsEnum.DIRECTION_NORTH_WEST:
                    return (short)(Cell1 - (DiagonalsCells.ContainsKey(Cell1) ? 15 : 14));

                case DirectionsEnum.DIRECTION_SOUTH_WEST:
                    return (short)(Cell1 + (DiagonalsCells.ContainsKey(Cell1) ? 13 : 14));

                case DirectionsEnum.DIRECTION_NORTH_EAST:
                    return (short)(Cell1 - (DiagonalsCells.ContainsKey(Cell1) ? 14 : 13));

                default:
                    return 0;
            }
        }
コード例 #41
0
ファイル: PathHelper.cs プロジェクト: thomasvinot/Symbioz
        public static short GetNearCellByDirection(short Cell1, DirectionsEnum Direction)
        {
            switch (Direction)
            {
                case DirectionsEnum.DIRECTION_EAST:
                    return (short)(Cell1 + 1);

                case DirectionsEnum.DIRECTION_WEST:
                    return (short)(Cell1 - 1);

                case DirectionsEnum.DIRECTION_SOUTH:
                    return (short)(Cell1 + 28);

                case DirectionsEnum.DIRECTION_NORTH:
                    return (short)(Cell1 - 28);

                case DirectionsEnum.DIRECTION_SOUTH_EAST:
                    return (short)(Cell1 + 29);

                case DirectionsEnum.DIRECTION_NORTH_WEST:
                    return (short)(Cell1 - 29);

                case DirectionsEnum.DIRECTION_SOUTH_WEST:
                    return (short)(Cell1 + 27);

                case DirectionsEnum.DIRECTION_NORTH_EAST:
                    return (short)(Cell1 - 27);

                default:
                    return 0;
            }
        }
コード例 #42
0
ファイル: Zone.cs プロジェクト: Guiedo/BehaviorIsManaged
 public Zone(SpellShapeEnum shape, byte radius, DirectionsEnum direction)
 {
     Radius = radius;
     Direction = direction;
     ShapeType = shape;
 }
コード例 #43
0
ファイル: Cell.cs プロジェクト: Sydre/BehaviorIsManaged
 public Cell GetNearestCellInDirection(DirectionsEnum direction)
 {
     return GetCellInDirection(direction, 1);
 }
コード例 #44
0
ファイル: Cell.cs プロジェクト: Sydre/BehaviorIsManaged
        /// <summary>
        /// Returns null if the cell is not in the map
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="step"></param>
        /// <returns></returns>
        public Cell GetCellInDirection(DirectionsEnum direction, short step)
        {
            Point mapPoint;
            switch (direction)
            {
                case DirectionsEnum.DIRECTION_EAST:
                    {
                        mapPoint = new Point(Point.X + step, Point.Y + step);
                        break;
                    }
                case DirectionsEnum.DIRECTION_SOUTH_EAST:
                    {
                        mapPoint = new Point(Point.X + step, Point.Y);
                        break;
                    }
                case DirectionsEnum.DIRECTION_SOUTH:
                    {
                        mapPoint = new Point(Point.X + step, Point.Y - step);
                        break;
                    }
                case DirectionsEnum.DIRECTION_SOUTH_WEST:
                    {
                        mapPoint = new Point(Point.X, Point.Y - step);
                        break;
                    }
                case DirectionsEnum.DIRECTION_WEST:
                    {
                        mapPoint = new Point(Point.X - step, Point.Y - step);
                        break;
                    }
                case DirectionsEnum.DIRECTION_NORTH_WEST:
                    {
                        mapPoint = new Point(Point.X - step, Point.Y);
                        break;
                    }
                case DirectionsEnum.DIRECTION_NORTH:
                    {
                        mapPoint = new Point(Point.X - step, Point.Y + step);
                        break;
                    }
                case DirectionsEnum.DIRECTION_NORTH_EAST:
                    {
                        mapPoint = new Point(Point.X, Point.Y + step);
                        break;
                    }
                default:
                    throw new Exception("Unknown direction : " + direction);
            }

            if (IsInMap(mapPoint.X, mapPoint.Y))
                return Map.Cells[mapPoint];
            return null;
        }