Exemplo n.º 1
0
 public Position3D Rotate(Direction dir)
 {
     Position3D p = new Position3D();
     p.X = dir.Shift(1) * X + dir.Shift(0) * Z;
     p.Y = 0;
     p.Z = dir.Shift(1) * Z + dir.Shift(3) * X;
     return p;
 }
Exemplo n.º 2
0
 public void SetDirection(Direction dir)
 {
     direction = dir;
 }
Exemplo n.º 3
0
        private bool CanMove()
        {
            if (Actor.Movement == null)
                Actor.Movement = this;
            else if (Actor.Movement != this)
                return false;

            Position3D offset = Template.PositionOffset;
            if (Template.FollowDirection)
                offset = offset.Rotate(Actor.Direction);
            pos = Actor.Position.Offset(offset);

            // TODO: Test actor
            Model m = Game.Scene[pos];
            if (m != null)
            {
                // Raise event whenever there's something ahead
                Event.Raise(m, Model.Collided);
                // Don't go if it collidable (or you will get hit!)
                if (m.Template.IsCollidable)
                    return false;
            }

            dir = Actor.Direction.Offset(Template.DirectionOffset);
            return true;
        }