示例#1
0
        private int Inc(ObjectStatus.RelativeSpeed speed, int posoneg, int location)
        {
            int inc;

            switch (speed)
            {
            case (ObjectStatus.RelativeSpeed.Fast):
                inc = 2;
                break;

            case ObjectStatus.RelativeSpeed.Slow:
                inc = 1;
                break;

            case ObjectStatus.RelativeSpeed.Stopped:
            default:
                return(location);
            }
            if (posoneg > 0)
            {
                return(location + inc);
            }
            if (posoneg < 0)
            {
                return(location - inc);
            }
            return(location);
        }
示例#2
0
        public bool Next(ObjectStatus.RelativeSpeed speed, out ScreenCell2D next)
        {
            next = this.here;
            if (next.Equals(there))
            {
                return(true);
            }

            course.XPos = this.there.XPos - this.here.XPos;
            course.YPos = this.there.YPos - this.here.YPos;
            switch (rnd.Next(1, 3))
            {
            case 1:
                next.XPos = Inc(speed, course.XPos, next.XPos);
                break;

            case 2:
                next.YPos = Inc(speed, course.YPos, next.YPos);
                break;

            case 3:
                next.XPos = Inc(speed, course.XPos, next.XPos);
                next.YPos = Inc(speed, course.YPos, next.YPos);
                break;
            }

            return(false);
        }
示例#3
0
 public static void Set(Noun noun, ObjectStatus.RelativeSpeed speed)
 {
     noun.speed = speed;
 }
示例#4
0
 public void DoDeInit()
 {
     this.state = ObjectStatus.ActiveState.Dead;
     this.speed = ObjectStatus.RelativeSpeed.Stopped;
 }
示例#5
0
 virtual public void DoInit()
 {
     state = ObjectStatus.ActiveState.Alive;
     speed = ObjectStatus.RelativeSpeed.Slow;
 }