Exemple #1
0
        public override bool Equals(object otherMoveJob)
        {
            if (otherMoveJob.GetType() != typeof(MoveJob))
            {
                return(false);
            }

            MoveJob other = (MoveJob)otherMoveJob;

            if (other._path[other._path.Length - 1]
                == _path[_path.Length - 1])
            {
                return(true);
            }
            return(false);
        }
Exemple #2
0
        // Movement
        public bool Move(ByteVector2 there)
        {
            // Try find path
            ByteVector2[] path = _context.MapContext().GetPath(CurrentPosition, there);

            // Exit if no path found
            if (path == null || path.Length == 0)
            {
                return(false);
            }

            // Initialize a new move job
            MoveJob newJob = new MoveJob(path, _context);

            if (_job == null ||                   // If the current job is null, accept
                !_job.Equals(newJob))             // If the current job is not "equivalent," accept
            {
                _job    = newJob;
                _status = Constants.Entities.Status.Moving;
                return(true);
            }
            return(false);
        }