Esempio n. 1
0
 public Vector3 GetPosition(PlayingField pf)
 {
     var d = Direction.DirectionAsPoint();
     return new Vector3(
         Location.X + d.X * Fraction,
         pf.GetElevation(this),
         Location.Y + d.Y * Fraction);
 }
Esempio n. 2
0
 public void Restart(PlayingField playingField, int length, Whereabouts? whereabouts = null)
 {
     Speed = InitialSpeed;
     Restart(playingField, whereabouts.GetValueOrDefault(PlayingField.PlayerWhereaboutsStart));
     DirectionTaker = null;
     SerpentStatus = SerpentStatus.Alive;
     while (length-- > 0)
         AddTail();
 }
Esempio n. 3
0
 public PlayerSerpent(
     LarvContent lcontent,
     PlayingField playingField)
     : base(lcontent,
         playingField,
         lcontent.Load<Texture2D>(@"Textures\snakeskin"),
         lcontent.Load<Texture2D>(@"Textures\snakeskinhead"),
         lcontent.Load<Texture2D>(@"Textures\snakeskinmap"), 
         lcontent.Load<Texture2D>(@"Textures\eggshell"))
 {
     Restart(playingField, 1);
 }
Esempio n. 4
0
 public EnemySerpent(
     LarvContent lcontent,
     PlayingField playingField,
     float delayBeforeStart,
     int length)
     : base(lcontent,
         playingField,
         lcontent.Load<Texture2D>(@"Textures\snakeskin"),
         lcontent.Load<Texture2D>(@"Textures\snakeskinhead"),
         lcontent.Load<Texture2D>(@"Textures\snakeskinmap"),
         lcontent.Load<Texture2D>(@"Textures\eggshell"))
 {
     _delayBeforeStart = delayBeforeStart;
     for (var i = 0; i < length; i++)
         AddTail();
 }
Esempio n. 5
0
        protected BaseSerpent(
            LarvContent lcontent,
            PlayingField playingField,
            Texture2D serpentSkin,
            Texture2D serpentHeadSkin,
            Texture2D serpentBump,
            Texture2D eggSkin)
            : base(lcontent.BumpEffect)
        {
            Restart(playingField, playingField.EnemyWhereaboutsStart);
            _sphere = lcontent.Sphere;
            _serpentSkin = serpentSkin;
            _serpentHeadSkin = serpentHeadSkin;
            _serpentBump = serpentBump;
            _eggSkin = eggSkin;
            _textureEffect = lcontent.TextureEffect;

            _headRotation.Add(Direction.East, Matrix.RotationY(MathUtil.Pi));
            _headRotation.Add(Direction.West, Matrix.Identity);
            _headRotation.Add(Direction.North, Matrix.RotationY(MathUtil.PiOverTwo));
            _headRotation.Add(Direction.South, Matrix.RotationY(-MathUtil.PiOverTwo));
        }
 public SerpentTailSegment(PlayingField pf, Whereabouts w)
 {
     _pf = pf;
     PathToWalk = new List<Whereabouts> { w };
 }
Esempio n. 7
0
        public void Restart(int scene)
        {
            if (PlayingField != null)
                PlayingField.Dispose();
            PlayingField = new PlayingField(
                LContent,
                LContent.Content.Load<Texture2D>(@"Textures\woodfloor"),
                scene);

            PlayerCave.SetPosition(PlayingField.PlayerWhereaboutsStart, PlayingField);
            EnemyCave.SetPosition(PlayingField.EnemyWhereaboutsStart, PlayingField);

            if (Scene != scene)
                LContent.Ground.GeneratePlayingField(PlayingField);
            Scene = scene;

            PlayerSerpent = new PlayerSerpent(
                LContent,
                PlayingField);

            Enemies.Clear();
            EnemyEggs.Clear();
            Frogs.Clear();
            PlayerEgg = null;

            var enemies = (7 + scene)/2;
            for (var i = 0; i < enemies; i++)
                Enemies.Add(new EnemySerpent(
                    LContent,
                    PlayingField,
                    i*1.5f,
                    2));

            for (var i = 0; i < 3; i++)
                Frogs.Add(new Frog(
                    LContent,
                    LContent.LoadEffect(@"Effects\SimpleTextureEffect"),
                    this));
        }
 public static Vector3 GetPlayerInitialLookAt(PlayingField pf)
 {
     return pf.PlayerWhereaboutsStart.GetPosition(pf);
     ;
 }
Esempio n. 9
0
 public void Restart(PlayingField playingField, Whereabouts whereabouts)
 {
     PlayingField = playingField;
     _whereabouts = whereabouts;
     HeadDirection = _whereabouts.Direction;
     _tail = new SerpentTailSegment(PlayingField, _whereabouts);
     _serpentLength = 1;
     _ascendToHeaven = 0;
     _layingEgg = -1;
     _pendingEatenSegments = 6;
 }
Esempio n. 10
0
 public void SetPosition(Whereabouts whereabouts, PlayingField playingField)
 {
     SetPosition(whereabouts.GetPosition(playingField), whereabouts.Direction);
 }
Esempio n. 11
0
 public PathFinder(PlayingField pf, Whereabouts home)
 {
     PlayingField = pf;
     Distance = new int[pf.TheField.GetUpperBound(0)+1, pf.TheField.GetUpperBound(1)+1, pf.TheField.GetUpperBound(2)+1];
     Explore(home.Floor, home.Location, 1, Direction.None);
 }