Esempio n. 1
0
        protected override SceneID GetNextMap(IMovesBetweenScenes actor, BorderSide exitSide)
        {
            var position = actor.Position.Center;

            switch (exitSide)
            {
            case BorderSide.Right:
                position.X = (float)(Scene.Position.Right + actor.Position.Width * 4);
                break;

            case BorderSide.Left:
                position.X = (float)(Scene.Position.Left - actor.Position.Width * 4);
                break;

            case BorderSide.Top:
                position.Y = (float)(Scene.Position.Top - actor.Position.Height * 4);
                break;

            case BorderSide.Bottom:
                position.Y = (float)(Scene.Position.Bottom + actor.Position.Height * 4);
                break;
            }

            position = MasterTemplate.PositionInMapToPointInTemplate(CurrentMap, position);

            var nextMapIndex = MasterTemplate.MapRegions.FindIndex(p => p.Contains(position));

            if (nextMapIndex == -1)
            {
                throw new ArgumentException("Unable to find adjacent map");
            }

            return(new SceneID(CurrentMap.Name, nextMapIndex));
        }
Esempio n. 2
0
        private Vector2 CalculateActorStart(IMovesBetweenScenes actorInLastScene, SceneID lastScene, Scene nextScene)
        {
            var templatePosition = MasterTemplate.PositionInMapToPointInTemplate(lastScene, actorInLastScene.Position.Center);

            var nextMapPosition = MasterTemplate.PointInTemplateToPositionInMap(nextScene.ID, templatePosition);

            return(nextMapPosition);
        }