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
+1 -1
View File
@@ -4,7 +4,7 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Subsurface")] [assembly: AssemblyTitle("Barotrauma")]
[assembly: AssemblyProduct("")] [assembly: AssemblyProduct("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
@@ -33,7 +33,7 @@ namespace Subsurface
} }
} }
public void SpawnSprites(int count) public void SpawnSprites(int count, Vector2? position = null)
{ {
activeSprites.Clear(); activeSprites.Clear();
@@ -45,18 +45,26 @@ namespace Subsurface
{ {
Vector2 pos = Vector2.Zero; 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 = new Vector2(wp.Rect.X, wp.Rect.Y);
pos += Rand.Vector(200.0f); pos += Rand.Vector(200.0f);
}
else
{
pos = Rand.Vector(2000.0f);
}
} }
else else
{ {
pos = Rand.Vector(2000.0f); pos = (Vector2)position;
} }
var prefab = prefabs[Rand.Int(prefabs.Count)]; var prefab = prefabs[Rand.Int(prefabs.Count)];
int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax); int amount = Rand.Range(prefab.SwarmMin, prefab.SwarmMax);
@@ -831,7 +831,7 @@ namespace Subsurface
Vector2 bodyVelocity = torso.body.LinearVelocity / 60.0f; Vector2 bodyVelocity = torso.body.LinearVelocity / 60.0f;
item.body.ResetDynamics(); 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++) for (int i = 0; i < 2; i++)
{ {
@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework; using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Subsurface.Items.Components; using Subsurface.Items.Components;
using System; using System;
@@ -16,7 +17,7 @@ namespace Subsurface
public static void Start() 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")); GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameModePreset.list.Find(gm => gm.Name.ToLower()=="tutorial"));
@@ -86,6 +87,8 @@ namespace Subsurface
private IEnumerable<object> UpdateState() private IEnumerable<object> UpdateState()
{ {
GameMain.GameScreen.BackgroundSpriteManager.SpawnSprites(1, Submarine.Loaded.Position + Character.Controlled.Position);
yield return new WaitForSeconds(4.0f); yield return new WaitForSeconds(4.0f);
infoBox = CreateInfoFrame("Use WASD to move and mouse to look around"); infoBox = CreateInfoFrame("Use WASD to move and mouse to look around");
@@ -277,10 +280,6 @@ namespace Subsurface
} }
yield return new WaitForSeconds(4.0f); 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."); infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
@@ -288,8 +287,12 @@ namespace Subsurface
{ {
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
} }
yield return new WaitForSeconds(8.0f);
var moloch = new Character("Content/Characters/Moloch/moloch.xml", steering.Item.SimPosition + Vector2.UnitX * 25.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); moloch.PlaySound(AIController.AiState.Attack);
yield return new WaitForSeconds(1.0f); yield return new WaitForSeconds(1.0f);
+4 -1
View File
@@ -76,7 +76,10 @@ namespace Subsurface
public Vector2 Position 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 public List<Vector2> PositionsOfInterest
+4 -2
View File
@@ -623,11 +623,13 @@ namespace Subsurface
loaded = this; 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(); sub.Load();
//Entity.dictionary.Add(int.MaxValue, sub); //Entity.dictionary.Add(int.MaxValue, sub);
+3 -1
View File
@@ -67,7 +67,8 @@ namespace Subsurface
AmbientSoundManager.Update(); 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; Vector2 targetMovement = Vector2.Zero;
if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f; if (PlayerInput.KeyDown(Keys.I)) targetMovement.Y += 1.0f;
@@ -77,6 +78,7 @@ namespace Subsurface
GameMain.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f); GameMain.GameSession.Submarine.ApplyForce(targetMovement * 100000.0f);
} }
#endif
if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime); if (GameMain.GameSession!=null) GameMain.GameSession.Update((float)deltaTime);
//EventManager.Update(gameTime); //EventManager.Update(gameTime);
Binary file not shown.
BIN
View File
Binary file not shown.