Tutorial fixes

This commit is contained in:
Regalis
2015-10-09 17:18:25 +03:00
parent 4120cabd6e
commit 0a96254696
9 changed files with 42 additions and 24 deletions

View File

@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Subsurface")]
[assembly: AssemblyTitle("Barotrauma")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]

View File

@@ -33,7 +33,7 @@ namespace Subsurface
}
}
public void SpawnSprites(int count)
public void SpawnSprites(int count, Vector2? position = null)
{
activeSprites.Clear();
@@ -45,17 +45,25 @@ namespace Subsurface
{
Vector2 pos = Vector2.Zero;
if (WayPoint.WayPointList.Count>0)
if (position == null)
{
WayPoint wp = WayPoint.WayPointList[Rand.Int(WayPoint.WayPointList.Count)];
if (WayPoint.WayPointList.Count>0)
{
WayPoint wp = WayPoint.WayPointList[Rand.Int(WayPoint.WayPointList.Count)];
pos = new Vector2(wp.Rect.X, wp.Rect.Y);
pos += Rand.Vector(200.0f);
pos = new Vector2(wp.Rect.X, wp.Rect.Y);
pos += Rand.Vector(200.0f);
}
else
{
pos = Rand.Vector(2000.0f);
}
}
else
{
pos = Rand.Vector(2000.0f);
}
pos = (Vector2)position;
}
var prefab = prefabs[Rand.Int(prefabs.Count)];

View File

@@ -831,7 +831,7 @@ namespace Subsurface
Vector2 bodyVelocity = torso.body.LinearVelocity / 60.0f;
item.body.ResetDynamics();
item.body.SetTransform(MathUtils.SmoothStep(item.body.SimPosition, transformedHoldPos + bodyVelocity, 0.5f), itemAngle);
item.SetTransform(MathUtils.SmoothStep(item.body.SimPosition, transformedHoldPos + bodyVelocity, 0.5f), itemAngle);
for (int i = 0; i < 2; i++)
{

View File

@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Subsurface.Items.Components;
using System;
@@ -16,7 +17,7 @@ namespace Subsurface
public static void Start()
{
Submarine.Load("Content/Map/TutorialSub.gz");
Submarine.Load("Content/Map/TutorialSub.gz", "");
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLower()=="tutorial"));
@@ -86,6 +87,8 @@ namespace Subsurface
private IEnumerable<object> UpdateState()
{
GameMain.GameScreen.BackgroundSpriteManager.SpawnSprites(1, Submarine.Loaded.Position + Character.Controlled.Position);
yield return new WaitForSeconds(4.0f);
infoBox = CreateInfoFrame("Use WASD to move and mouse to look around");
@@ -276,20 +279,20 @@ namespace Subsurface
yield return CoroutineStatus.Running;
}
yield return new WaitForSeconds(4.0f);
infoBox = CreateInfoFrame("The submarine moves up and down by pumping water in and out of the two ballast tanks at the bottom of the submarine. "
+"The engine at the back of the sub moves it forwards and backwards.");
yield return new WaitForSeconds(8.0f);
infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
while (Submarine.Loaded.Position.Y > 31000.0f)
{
yield return CoroutineStatus.Running;
}
var moloch = new Character("Content/Characters/Moloch/moloch.xml", steering.Item.SimPosition + Vector2.UnitX * 25.0f);
yield return new WaitForSeconds(8.0f);
infoBox = CreateInfoFrame("The submarine moves up and down by pumping water in and out of the two ballast tanks at the bottom of the submarine. "
+"The engine at the back of the sub moves it forwards and backwards.");
var moloch = new AICharacter("Content/Characters/Moloch/moloch.xml", steering.Item.SimPosition + Vector2.UnitX * 25.0f);
moloch.PlaySound(AIController.AiState.Attack);
yield return new WaitForSeconds(1.0f);

View File

@@ -76,7 +76,10 @@ namespace Subsurface
public Vector2 Position
{
get { return ConvertUnits.ToDisplayUnits(cells[0].body.Position); }
get
{
return cells==null ? Vector2.Zero : ConvertUnits.ToDisplayUnits(cells[0].body.Position);
}
}
public List<Vector2> PositionsOfInterest

View File

@@ -623,11 +623,13 @@ namespace Subsurface
loaded = this;
}
public static Submarine Load(string fileName)
public static Submarine Load(string fileName, string folder = SavePath)
{
Unload();
Unload();
Submarine sub = new Submarine(SavePath+"/"+fileName);
string path = string.IsNullOrWhiteSpace(folder) ? fileName : System.IO.Path.Combine(SavePath, fileName);
Submarine sub = new Submarine(path);
sub.Load();
//Entity.dictionary.Add(int.MaxValue, sub);

View File

@@ -67,7 +67,8 @@ namespace Subsurface
AmbientSoundManager.Update();
if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
#if DEBUG
if (GameMain.GameSession != null && GameMain.GameSession.Level != null && GameMain.GameSession.Submarine != null)
{
Vector2 targetMovement = Vector2.Zero;
if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f;
@@ -77,6 +78,7 @@ namespace Subsurface
GameMain.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f);
}
#endif
if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime);
//EventManager.Update(gameTime);

Binary file not shown.

Binary file not shown.