electricity bugfixes, destructable doors, ai improvements, removed rope, container changes
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Xml.Linq;
|
||||
using FarseerPhysics;
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using FarseerPhysics.Dynamics;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -41,7 +42,7 @@ namespace Subsurface
|
||||
//a point in a wall which the character is currently targeting
|
||||
private Vector2 wallAttackPos;
|
||||
//the entity (a wall) which the character is targeting
|
||||
private MapEntity targetEntity;
|
||||
private IDamageable targetEntity;
|
||||
|
||||
//the limb selected for the current attack
|
||||
private Limb attackingLimb;
|
||||
@@ -157,23 +158,7 @@ namespace Subsurface
|
||||
|
||||
if (coolDownTimer>0.0f)
|
||||
{
|
||||
coolDownTimer -= deltaTime;
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine("cooldown");
|
||||
|
||||
if (selectedTarget.entity is Hull ||
|
||||
Vector2.Distance(attackPosition, character.animController.limbs[0].SimPosition)<ConvertUnits.ToSimUnits(500.0f))
|
||||
{
|
||||
steeringManager.SteeringSeek(attackPosition, -0.8f);
|
||||
steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
steeringManager.SteeringSeek(attackPosition, -0.5f);
|
||||
steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||
|
||||
}
|
||||
|
||||
UpdateCoolDown(attackPosition, deltaTime);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -183,45 +168,7 @@ namespace Subsurface
|
||||
}
|
||||
else
|
||||
{
|
||||
targetEntity = null;
|
||||
//check if there's a wall between the target and the character
|
||||
Vector2 rayStart = character.animController.limbs[0].SimPosition;
|
||||
Vector2 rayEnd = selectedTarget.Position;
|
||||
Structure closestStructure = Map.CheckVisibility(rayStart, rayEnd);
|
||||
if (Map.LastPickedFraction == 1.0f || closestStructure == null)
|
||||
{
|
||||
wallAttackPos = Vector2.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
Structure wall = closestStructure as Structure;
|
||||
if (wall==null)
|
||||
{
|
||||
wallAttackPos = Map.LastPickedPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
int sectionIndex = wall.FindSectionIndex(ConvertUnits.ToDisplayUnits(Map.LastPickedPosition));
|
||||
|
||||
float sectionDamage = wall.SectionDamage(sectionIndex);
|
||||
for (int i = sectionIndex-2; i<=sectionIndex+2; i++)
|
||||
{
|
||||
if (wall.SectionHasHole(i))
|
||||
{
|
||||
sectionIndex = i;
|
||||
break;
|
||||
}
|
||||
if (wall.SectionDamage(i) > sectionDamage) sectionIndex = i;
|
||||
}
|
||||
wallAttackPos = wall.SectionPosition(sectionIndex);
|
||||
wallAttackPos = ConvertUnits.ToSimUnits(wallAttackPos);
|
||||
}
|
||||
|
||||
|
||||
targetEntity = closestStructure;
|
||||
}
|
||||
GetTargetEntity();
|
||||
|
||||
raycastTimer = RaycastInterval;
|
||||
}
|
||||
@@ -246,13 +193,68 @@ namespace Subsurface
|
||||
|
||||
}
|
||||
|
||||
private void UpdateCoolDown(Vector2 attackPosition, float deltaTime)
|
||||
{
|
||||
coolDownTimer -= deltaTime;
|
||||
attackingLimb = null;
|
||||
|
||||
//System.Diagnostics.Debug.WriteLine("cooldown");
|
||||
|
||||
if (selectedTarget.entity is Hull ||
|
||||
Vector2.Distance(attackPosition, character.animController.limbs[0].SimPosition) < ConvertUnits.ToSimUnits(500.0f))
|
||||
{
|
||||
steeringManager.SteeringSeek(attackPosition, -0.8f);
|
||||
steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
steeringManager.SteeringSeek(attackPosition, -0.5f);
|
||||
steeringManager.SteeringAvoid(deltaTime, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void GetTargetEntity()
|
||||
{
|
||||
targetEntity = null;
|
||||
//check if there's a wall between the target and the character
|
||||
Vector2 rayStart = character.animController.limbs[0].SimPosition;
|
||||
Vector2 rayEnd = selectedTarget.Position;
|
||||
Body closestBody = Map.CheckVisibility(rayStart, rayEnd);
|
||||
|
||||
if (Map.LastPickedFraction == 1.0f || closestBody == null)
|
||||
{
|
||||
wallAttackPos = Vector2.Zero;
|
||||
return;
|
||||
}
|
||||
|
||||
Structure wall = closestBody.UserData as Structure;
|
||||
if (wall == null)
|
||||
{
|
||||
wallAttackPos = Map.LastPickedPosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
int sectionIndex = wall.FindSectionIndex(ConvertUnits.ToDisplayUnits(Map.LastPickedPosition));
|
||||
|
||||
float sectionDamage = wall.SectionDamage(sectionIndex);
|
||||
for (int i = sectionIndex - 2; i <= sectionIndex + 2; i++)
|
||||
{
|
||||
if (wall.SectionHasHole(i))
|
||||
{
|
||||
sectionIndex = i;
|
||||
break;
|
||||
}
|
||||
if (wall.SectionDamage(i) > sectionDamage) sectionIndex = i;
|
||||
}
|
||||
wallAttackPos = wall.SectionPosition(sectionIndex);
|
||||
wallAttackPos = ConvertUnits.ToSimUnits(wallAttackPos);
|
||||
}
|
||||
|
||||
targetEntity = closestBody.UserData as IDamageable;
|
||||
}
|
||||
|
||||
private void UpdateLimbAttack(float deltaTime, Limb limb, Vector2 attackPosition)
|
||||
{
|
||||
//DamageType damageType = DamageType.None;
|
||||
// float damage = 0.0f;
|
||||
|
||||
//bool hasAttacked = false;
|
||||
|
||||
IDamageable damageTarget = null;
|
||||
|
||||
switch (limb.attack.type)
|
||||
@@ -310,21 +312,14 @@ namespace Subsurface
|
||||
attackTimer = 0.0f;
|
||||
if (Vector2.Distance(limb.SimPosition, attackPosition)<5.0) coolDownTimer = attackCoolDown;
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("cooldown: " + coolDownTimer);
|
||||
}
|
||||
}
|
||||
|
||||
//private float GetAttackDamage(Limb limb, float deltaTime)
|
||||
//{
|
||||
// return (limb.attack.duration == 0.0f) ? limb.attack.damage : limb.attack.damage * deltaTime;
|
||||
//}
|
||||
|
||||
|
||||
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
||||
//whether the character can see/hear the target and chooses the most preferable target within
|
||||
//sight/hearing range
|
||||
public void UpdateTargets(Character character)
|
||||
{
|
||||
|
||||
if (distanceAccumulator<5.0f && Game1.random.Next(1,3)==1)
|
||||
{
|
||||
selectedTarget = null;
|
||||
@@ -344,6 +339,9 @@ namespace Subsurface
|
||||
{
|
||||
float valueModifier = 0.0f;
|
||||
float dist = 0.0f;
|
||||
|
||||
IDamageable targetDamageable = target.entity as IDamageable;
|
||||
if (targetDamageable!=null && targetDamageable.Health <= 0.0f) continue;
|
||||
|
||||
Character targetCharacter = target.entity as Character;
|
||||
|
||||
@@ -371,30 +369,49 @@ namespace Subsurface
|
||||
|
||||
AITargetMemory targetMemory = FindTargetMemory(target);
|
||||
|
||||
valueModifier *= targetMemory.Priority;
|
||||
valueModifier = valueModifier * targetMemory.Priority / dist;
|
||||
//dist -= targetMemory.Priority;
|
||||
|
||||
if (valueModifier != 0.0f && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
|
||||
{
|
||||
//if the target is a character, check if it is visible
|
||||
if (Math.Abs(valueModifier) > Math.Abs(this.targetValue) && (dist < target.SightRange * sight || dist < target.SoundRange * hearing))
|
||||
{
|
||||
Vector2 rayStart = character.animController.limbs[0].SimPosition;
|
||||
Vector2 rayEnd = target.Position;
|
||||
|
||||
Body closestBody = Map.CheckVisibility(rayStart, rayEnd);
|
||||
Structure closestStructure = (closestBody == null) ? null : closestBody.UserData as Structure;
|
||||
|
||||
if (targetCharacter != null)
|
||||
{
|
||||
Vector2 rayStart = character.animController.limbs[0].SimPosition;
|
||||
Vector2 rayEnd = target.Position;
|
||||
|
||||
Structure closestStructure = Map.CheckVisibility(rayStart, rayEnd);
|
||||
//System.Diagnostics.Debug.WriteLine("closestfraction: " + closestFraction);
|
||||
//if not visible, ignore this AItarget
|
||||
//if target is a character that isn't visible, ignore
|
||||
if (closestStructure != null) continue;
|
||||
}
|
||||
|
||||
float newTargetValue = valueModifier/dist;
|
||||
if (selectedTarget == null || Math.Abs(newTargetValue) > Math.Abs(this.targetValue))
|
||||
//prefer targets with low health
|
||||
valueModifier = valueModifier / targetCharacter.Health;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetDamageable != null)
|
||||
{
|
||||
valueModifier = valueModifier / targetDamageable.Health;
|
||||
|
||||
}
|
||||
else if (closestStructure!=null)
|
||||
{
|
||||
valueModifier = valueModifier / (closestStructure as IDamageable).Health;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//float newTargetValue = valueModifier/dist;
|
||||
if (selectedTarget == null || Math.Abs(valueModifier) > Math.Abs(this.targetValue))
|
||||
{
|
||||
selectedTarget = target;
|
||||
selectedTargetMemory = targetMemory;
|
||||
targetValue = newTargetValue;
|
||||
Debug.WriteLine(selectedTarget);
|
||||
|
||||
this.targetValue = valueModifier;
|
||||
Debug.WriteLine(selectedTarget.entity+": "+targetValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,7 +466,7 @@ namespace Subsurface
|
||||
message.Write(raycastTimer);
|
||||
message.Write(coolDownTimer);
|
||||
|
||||
message.Write(targetEntity==null ? -1 : targetEntity.ID);
|
||||
message.Write(targetEntity==null ? -1 : (targetEntity as Entity).ID);
|
||||
}
|
||||
|
||||
public override void ReadNetworkData(NetIncomingMessage message)
|
||||
@@ -472,7 +489,7 @@ namespace Subsurface
|
||||
this.coolDownTimer = coolDownTimer;
|
||||
|
||||
if (targetID>-1)
|
||||
targetEntity = Entity.FindEntityByID(targetID) as MapEntity;
|
||||
targetEntity = Entity.FindEntityByID(targetID) as IDamageable;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using FarseerPhysics.Dynamics;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -112,25 +113,29 @@ namespace Subsurface
|
||||
if (rayCastTimer <= 0.0f)
|
||||
{
|
||||
rayCastTimer = RayCastInterval;
|
||||
Structure closestStructure = Map.CheckVisibility(host.Position, ahead);
|
||||
if (closestStructure == null)
|
||||
Body closestBody = Map.CheckVisibility(host.Position, ahead);
|
||||
if (closestBody == null)
|
||||
{
|
||||
avoidSteering = Vector2.Zero;
|
||||
return Vector2.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 obstaclePosition = Map.LastPickedPosition;
|
||||
if (closestStructure.IsHorizontal)
|
||||
Structure closestStructure = closestBody.UserData as Structure;
|
||||
if (closestStructure!=null)
|
||||
{
|
||||
obstaclePosition.Y = closestStructure.SimPosition.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
obstaclePosition.X = closestStructure.SimPosition.X;
|
||||
}
|
||||
Vector2 obstaclePosition = Map.LastPickedPosition;
|
||||
if (closestStructure.IsHorizontal)
|
||||
{
|
||||
obstaclePosition.Y = closestStructure.SimPosition.Y;
|
||||
}
|
||||
else
|
||||
{
|
||||
obstaclePosition.X = closestStructure.SimPosition.X;
|
||||
}
|
||||
|
||||
avoidSteering = Vector2.Normalize(Map.LastPickedPosition - obstaclePosition);
|
||||
avoidSteering = Vector2.Normalize(Map.LastPickedPosition - obstaclePosition);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -119,6 +119,20 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
public float Health
|
||||
{
|
||||
get
|
||||
{
|
||||
float totalHealth = 0.0f;
|
||||
foreach (Limb l in animController.limbs)
|
||||
{
|
||||
totalHealth += (l.MaxHealth - l.Damage);
|
||||
|
||||
}
|
||||
return totalHealth/animController.limbs.Count();
|
||||
}
|
||||
}
|
||||
|
||||
public float Blood
|
||||
{
|
||||
get { return blood; }
|
||||
@@ -637,29 +651,25 @@ namespace Subsurface
|
||||
Vector2 particleVel = closestLimb.SimPosition-position;
|
||||
if (particleVel != Vector2.Zero) particleVel = Vector2.Normalize(particleVel);
|
||||
|
||||
Game1.particleManager.CreateParticle(
|
||||
Game1.particleManager.CreateParticle("blood",
|
||||
closestLimb.SimPosition,
|
||||
ToolBox.RandomFloat(0.0f, 3.1f),
|
||||
particleVel * ToolBox.RandomFloat(1.0f,3.0f),
|
||||
"blood");
|
||||
particleVel * ToolBox.RandomFloat(1.0f,3.0f));
|
||||
}
|
||||
|
||||
for (int i = 0; i < bloodAmount / 2; i++)
|
||||
{
|
||||
Game1.particleManager.CreateParticle(closestLimb.SimPosition,
|
||||
0.0f,
|
||||
Vector2.Zero, "waterblood");
|
||||
Game1.particleManager.CreateParticle("waterblood",closestLimb.SimPosition,Vector2.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
public void Stun()
|
||||
{
|
||||
for (int i = 0; i < selectedItems.Length; i++ )
|
||||
{
|
||||
if (selectedItems[i] == null) continue;
|
||||
selectedItems[i].Drop();
|
||||
selectedItems[i] = null;
|
||||
}
|
||||
//for (int i = 0; i < selectedItems.Length; i++ )
|
||||
//{
|
||||
// if (selectedItems[i] == null) continue;
|
||||
// selectedItems[i].Drop();
|
||||
// selectedItems[i] = null;
|
||||
//}
|
||||
|
||||
selectedConstruction = null;
|
||||
}
|
||||
@@ -691,17 +701,14 @@ namespace Subsurface
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Particle p = Game1.particleManager.CreateParticle(
|
||||
Particle p = Game1.particleManager.CreateParticle("waterblood",
|
||||
torso.SimPosition + new Vector2(ToolBox.RandomFloat(-0.5f, 0.5f), ToolBox.RandomFloat(-0.5f, 0.5f)),
|
||||
0.0f,
|
||||
Vector2.Zero, "waterblood");
|
||||
Vector2.Zero);
|
||||
if (p!=null) p.Size *= 2.0f;
|
||||
|
||||
Game1.particleManager.CreateParticle(
|
||||
Game1.particleManager.CreateParticle("bubbles",
|
||||
torso.SimPosition,
|
||||
0.0f,
|
||||
new Vector2(ToolBox.RandomFloat(-0.5f, 0.5f), ToolBox.RandomFloat(-1.0f,0.5f)),
|
||||
"bubbles");
|
||||
new Vector2(ToolBox.RandomFloat(-0.5f, 0.5f), ToolBox.RandomFloat(-1.0f,0.5f)));
|
||||
}
|
||||
|
||||
foreach (var joint in animController.limbJoints)
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Subsurface
|
||||
|
||||
if (!inWater) movement.Y = Math.Min(0.0f, movement.Y);
|
||||
|
||||
float movementAngle = ToolBox.VectorToAngle(movement)+MathHelper.PiOver2;
|
||||
float movementAngle = ToolBox.VectorToAngle(movement) - MathHelper.PiOver2;
|
||||
|
||||
Limb tail = GetLimb(LimbType.Tail);
|
||||
if (tail != null && waveAmplitude>0.0f)
|
||||
|
||||
@@ -129,6 +129,11 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxHealth
|
||||
{
|
||||
get { return maxHealth; }
|
||||
}
|
||||
|
||||
public float Bleeding
|
||||
{
|
||||
get { return bleeding; }
|
||||
@@ -290,9 +295,9 @@ namespace Subsurface
|
||||
|
||||
if (ToolBox.RandomFloat(0.0f, 1000.0f) < Bleeding)
|
||||
{
|
||||
Game1.particleManager.CreateParticle(SimPosition,
|
||||
MathHelper.Pi,
|
||||
ToolBox.RandomFloat(0.0f, 0.0f), !inWater ? "blood" : "waterblood");
|
||||
Game1.particleManager.CreateParticle(
|
||||
!inWater ? "blood" : "waterblood",
|
||||
SimPosition, Vector2.Zero);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,15 +72,16 @@ namespace Subsurface
|
||||
float damageAmount = 0.0f;
|
||||
DamageSoundType damageSoundType = DamageSoundType.None;
|
||||
|
||||
if (target as Structure == null)
|
||||
{
|
||||
damageAmount = damage;
|
||||
damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.LimbBlunt : DamageSoundType.LimbSlash;
|
||||
}
|
||||
else
|
||||
if (target as Character == null)
|
||||
{
|
||||
damageAmount = structureDamage;
|
||||
damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.StructureBlunt: DamageSoundType.StructureSlash;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
damageAmount = damage;
|
||||
damageSoundType = (damageType == DamageType.Blunt) ? DamageSoundType.LimbBlunt : DamageSoundType.LimbSlash;
|
||||
}
|
||||
|
||||
if (playSound) AmbientSoundManager.PlayDamageSound(damageSoundType, damageAmount, position);
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Subsurface
|
||||
|
||||
Limb l = (Limb)f1.Body.UserData;
|
||||
|
||||
if (impact > 1.0f && l.HitSound != null && l.soundTimer<=0.0f) l.HitSound.Play(Math.Min(impact / 5.0f, 1.0f));
|
||||
if (impact > 1.0f && l.HitSound != null && l.soundTimer<=0.0f) l.HitSound.Play(Math.Min(impact / 5.0f, 1.0f), impact*100.0f, l.body.FarseerBody);
|
||||
|
||||
if (impact > l.impactTolerance)
|
||||
{
|
||||
@@ -308,9 +308,7 @@ namespace Subsurface
|
||||
|
||||
public virtual void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
foreach (Limb limb in limbs)
|
||||
{
|
||||
limb.Draw(spriteBatch, DebugDraw);
|
||||
@@ -340,11 +338,9 @@ namespace Subsurface
|
||||
foreach (RevoluteJoint joint in limbJoints)
|
||||
{
|
||||
Vector2 pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorA);
|
||||
pos.Y = -pos.Y;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true);
|
||||
|
||||
pos = ConvertUnits.ToDisplayUnits(joint.WorldAnchorB);
|
||||
pos.Y = -pos.Y;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)-pos.Y, 5, 5), Color.White, true);
|
||||
}
|
||||
|
||||
@@ -494,16 +490,20 @@ namespace Subsurface
|
||||
{
|
||||
|
||||
//create a splash particle
|
||||
Game1.particleManager.CreateParticle(
|
||||
Subsurface.Particles.Particle splash = Game1.particleManager.CreateParticle("watersplash",
|
||||
new Vector2(limb.SimPosition.X, ConvertUnits.ToSimUnits(limbHull.Surface)),
|
||||
0.0f,
|
||||
new Vector2(0.0f, Math.Abs(limb.LinearVelocity.Y*0.1f)),
|
||||
"watersplash");
|
||||
Game1.particleManager.CreateParticle(
|
||||
new Vector2(limb.SimPosition.X, ConvertUnits.ToSimUnits(limbHull.Surface)),
|
||||
0.0f,
|
||||
new Vector2(0.0f, Math.Abs(-limb.LinearVelocity.Y * 0.1f)),
|
||||
0.0f);
|
||||
|
||||
if (splash != null) splash.yLimits = ConvertUnits.ToSimUnits(
|
||||
new Vector2(
|
||||
limbHull.Rect.Y,
|
||||
limbHull.Rect.Y - limbHull.Rect.Height));
|
||||
|
||||
Game1.particleManager.CreateParticle("bubbles",
|
||||
new Vector2(limb.SimPosition.X, ConvertUnits.ToSimUnits(limbHull.Surface)),
|
||||
limb.LinearVelocity*0.001f,
|
||||
"bubbles");
|
||||
0.0f);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
<limb id = "3" width="13" height="45" mass = "6" ignorecollisions="true" flip="true">
|
||||
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
|
||||
<attack type="PinchCW" range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="20" structuredamage="80" damagetype="slash"/>
|
||||
<attack type="PinchCW" range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="20" structuredamage="350" damagetype="slash"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "4" width="11" height="34" mass = "4" type="RightLeg" flip="true">
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<!-- lower yaw -->
|
||||
<limb id = "1" width="16" height="103">
|
||||
<sprite texture="Content/Characters/TigerThresher/tigerthresher.png" sourcerect="391,169,28,110" depth="0.025" origin="0.5,0.5"/>
|
||||
<attack type="PinchCCW" range="200" duration="0.5" damage="80" bleedingdamage="50" structuredamage="100" damagetype="slash"/>
|
||||
<attack type="PinchCCW" range="200" duration="0.5" damage="150" bleedingdamage="50" structuredamage="500" damagetype="slash"/>
|
||||
</limb>
|
||||
|
||||
<!-- body -->
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<Wearable limbtype="Head" slots="Any,Head">
|
||||
<sprite texture="DivingMask.png" limb="Head" sourcerect="1,1,37,38"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank" Condition="-0.1" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank" Condition="-0.25" Oxygen="20.0"/>
|
||||
</Wearable>
|
||||
|
||||
<ItemContainer capacity="1" hideitems="true">
|
||||
@@ -38,7 +38,7 @@
|
||||
<sprite texture="DivingSuit.png" limb="RightArm" sourcerect="0,0,18,40" origin="0.5,0.4" depth="0.005"/>
|
||||
<sprite texture="DivingSuit.png" limb="LeftArm" sourcerect="0,0,18,40" origin="0.5,0.4" depth="0.005"/>
|
||||
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank" Condition="-0.1" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Contained,Character" targetnames="Oxygen Tank" Condition="-0.25" Oxygen="20.0"/>
|
||||
<StatusEffect type="OnWearing" target="Character" PressureProtection="100.0"/>
|
||||
</Wearable>
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
<Door>
|
||||
<Sprite texture ="door.png" sourcerect="80,0,19,208" depth="0.4" origin="0.5,0.0"/>
|
||||
</Door>
|
||||
|
||||
<AiTarget sightrange="5000.0"/>
|
||||
|
||||
<ConnectionPanel canbeselected = "true">
|
||||
<requireditem name="Screwdriver" type="Equipped"/>
|
||||
@@ -30,6 +32,8 @@
|
||||
<Sprite texture ="door.png" sourcerect="56,0,19,208" depth="0.4" origin="0.5,0.0"/>
|
||||
</Door>
|
||||
|
||||
<AiTarget sightrange="5000.0"/>
|
||||
|
||||
<ConnectionPanel canbeselected = "true">
|
||||
<requireditem name="Screwdriver" type="Equipped"/>
|
||||
<input name="toggle"/>
|
||||
|
||||
@@ -8,4 +8,9 @@
|
||||
|
||||
<MiniMap MinVoltage="0.5" PowerConsumption="100" canbeselected = "true"/>
|
||||
|
||||
<ConnectionPanel canbeselected = "true">
|
||||
<requireditem name="Screwdriver" type="Equipped"/>
|
||||
<input name="power_in"/>
|
||||
</ConnectionPanel>
|
||||
|
||||
</Item>
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<Pickable slots="Any"/>
|
||||
<Projectile launchimpulse="20.0" damage="20.0" bleedingdamage="20.0" doesstick="true">
|
||||
<Attack damage="20" bleeding="20" structuredamage="50" damagetype="Blunt"/>
|
||||
<Attack damage="20" bleeding="30" structuredamage="50" damagetype="Blunt"/>
|
||||
</Projectile>
|
||||
</Item>
|
||||
|
||||
@@ -33,9 +33,7 @@
|
||||
<RequiredItems name="Harpoon" type="Contained"/>
|
||||
</RangedWeapon>
|
||||
|
||||
<Rope sprite="Content/Items/Weapons/rope.png" projectileanchorx="-40.0"/>
|
||||
|
||||
<ItemContainer hideitems="true">
|
||||
<ItemContainer itempos="27,11" iteminterval="0,-4" hideitems="false">
|
||||
<Containable name="Harpoon"/>
|
||||
</ItemContainer>
|
||||
</Item>
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
linkable="true"
|
||||
pickdistance="150">
|
||||
|
||||
|
||||
<Sprite texture ="battery.png" depth="0.8"/>
|
||||
|
||||
<PowerContainer capacity="2000.0" maxinput="500.0" maxoutput="1000.0" canbeselected = "true"/>
|
||||
<PowerContainer capacity="2000.0" maxrechargespeed="500.0" maxoutput="1000.0" canbeselected = "true"/>
|
||||
|
||||
<ConnectionPanel canbeselected = "true">
|
||||
<requireditem name="Screwdriver" type="Equipped"/>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<Randomevents>
|
||||
<MonsterEvent name="Under attack" description=""
|
||||
characterfile="Content/Characters/Scorpion/scorpion.xml"
|
||||
characterfile="Content/Characters/Crawler/Crawler.xml"
|
||||
commonness="10"
|
||||
difficulty="10"
|
||||
minamount="2" maxamount="4"
|
||||
starttimemin="5" starttimemax="10"/>
|
||||
|
||||
<MonsterEvent name="Under attack" description=""
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Xml.Linq;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
|
||||
namespace Subsurface
|
||||
{
|
||||
@@ -17,7 +18,7 @@ namespace Subsurface
|
||||
characterFile = ToolBox.GetAttributeString(element, "characterfile", "");
|
||||
|
||||
minAmount = ToolBox.GetAttributeInt(element, "minamount", 1);
|
||||
maxAmount = ToolBox.GetAttributeInt(element, "maxamount", 1);
|
||||
maxAmount = Math.Max(ToolBox.GetAttributeInt(element, "maxamount", 1),minAmount);
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
@@ -30,10 +31,11 @@ namespace Subsurface
|
||||
|
||||
for (int i = 0; i < amount; i++)
|
||||
{
|
||||
monsters[i] = new Character(characterFile,
|
||||
(randomWayPoint == null) ? Vector2.Zero : randomWayPoint.SimPosition);
|
||||
Vector2 position = (randomWayPoint == null) ? Vector2.Zero : randomWayPoint.SimPosition;
|
||||
position.X += ToolBox.RandomFloat(-0.5f,0.5f);
|
||||
position.Y += ToolBox.RandomFloat(-0.5f,0.5f);
|
||||
monsters[i] = new Character(characterFile, position);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
|
||||
@@ -266,10 +266,14 @@ namespace Subsurface
|
||||
{
|
||||
spriteBatch.DrawString(font,
|
||||
"FPS: " + (int)Game1.frameCounter.AverageFramesPerSecond
|
||||
+ " - physics: " + Game1.world.UpdateTime
|
||||
+ " - bodies: " + Game1.world.BodyList.Count,
|
||||
+ " - render: "+Game1.renderTimeElapsed,
|
||||
new Vector2(10, 10), Color.White);
|
||||
|
||||
spriteBatch.DrawString(font,
|
||||
"Physics: " + Game1.world.UpdateTime
|
||||
+ " - bodies: " + Game1.world.BodyList.Count,
|
||||
new Vector2(10, 30), Color.White);
|
||||
|
||||
if (Character.Controlled != null)
|
||||
{
|
||||
drowningBar.BarSize = Character.Controlled.Oxygen/100.0f;
|
||||
@@ -335,8 +339,6 @@ namespace Subsurface
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (messages[0].LifeTime <= 0.0f) messages.Remove(messages[0]);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,9 @@ namespace Subsurface
|
||||
public static Random localRandom;
|
||||
public static Random random;
|
||||
|
||||
private Stopwatch renderTimer;
|
||||
public static int renderTimeElapsed;
|
||||
|
||||
|
||||
public Camera Cam
|
||||
{
|
||||
@@ -78,6 +81,8 @@ namespace Subsurface
|
||||
|
||||
frameCounter = new FrameCounter();
|
||||
|
||||
renderTimer = new Stopwatch();
|
||||
|
||||
IsMouseVisible = true;
|
||||
|
||||
IsFixedTimeStep = false;
|
||||
@@ -197,16 +202,18 @@ namespace Subsurface
|
||||
/// <summary>
|
||||
/// This is called when the game should draw itself.
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">elapsed time in seconds</param>
|
||||
protected override void Draw(GameTime gameTime)
|
||||
{
|
||||
//System.Diagnostics.Debug.WriteLine(deltaTime);
|
||||
//System.Diagnostics.Debug.WriteLine(gameTime.ElapsedGameTime.TotalSeconds);
|
||||
renderTimer.Restart();
|
||||
|
||||
double deltaTime = gameTime.ElapsedGameTime.TotalSeconds;
|
||||
|
||||
frameCounter.Update(deltaTime);
|
||||
|
||||
Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch);
|
||||
Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch);
|
||||
|
||||
renderTimeElapsed = (int)renderTimer.Elapsed.Ticks;
|
||||
renderTimer.Stop();
|
||||
}
|
||||
|
||||
protected override void OnExiting(object sender, EventArgs args)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Subsurface
|
||||
|
||||
guiFrame = new GUIFrame(new Rectangle(0, 50, 150, 450), Color.Transparent);
|
||||
|
||||
listBox = new GUIListBox(new Rectangle(0, 0, 150, 400), Color.Transparent, guiFrame);
|
||||
listBox = new GUIListBox(new Rectangle(0, 0, 150, 0), Color.Transparent, guiFrame);
|
||||
listBox.ScrollBarEnabled = false;
|
||||
listBox.OnSelected = SelectCharacter;
|
||||
|
||||
|
||||
@@ -97,6 +97,8 @@ namespace Subsurface
|
||||
|
||||
public void StartShift(int scriptedEventCount = 1)
|
||||
{
|
||||
if (crewManager.characterInfos.Count == 0) return;
|
||||
|
||||
crewManager.StartShift();
|
||||
taskManager.StartShift(scriptedEventCount);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace Subsurface
|
||||
for (int i = 0 ; i<amount ; i++)
|
||||
{
|
||||
availableCharacters.Add(new CharacterInfo(file));
|
||||
Debug.Write(availableCharacters.Last().name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,17 +54,19 @@ namespace Subsurface.Items.Components
|
||||
set { itemRotation = value; }
|
||||
}
|
||||
|
||||
//[Initable(Vector2.Zero)]
|
||||
//private Vector2 ItemPos
|
||||
//{
|
||||
// set { itemPos = ConvertUnits.ToSimUnits(value); }
|
||||
//}
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string ItemPos
|
||||
{
|
||||
get { return ToolBox.Vector2ToString(itemPos); }
|
||||
set { itemPos = ToolBox.ParseToVector2(value); }
|
||||
}
|
||||
|
||||
//[Initable(Vector2.Zero)]
|
||||
//private Vector2 ItemInterval
|
||||
//{
|
||||
// set { itemInterval = ConvertUnits.ToSimUnits(value); }
|
||||
//}
|
||||
[HasDefaultValue("0.0,0.0", false)]
|
||||
public string ItemInterval
|
||||
{
|
||||
get { return ToolBox.Vector2ToString(itemInterval); }
|
||||
set { itemInterval = ToolBox.ParseToVector2(value); }
|
||||
}
|
||||
|
||||
public ItemContainer(Item item, XElement element)
|
||||
: base (item, element)
|
||||
@@ -72,11 +74,11 @@ namespace Subsurface.Items.Components
|
||||
inventory = new ItemInventory(this, capacity);
|
||||
containableItems = new List<RelatedItem>();
|
||||
|
||||
itemPos = ToolBox.GetAttributeVector2(element, "ItemPos", Vector2.Zero);
|
||||
itemPos = ConvertUnits.ToSimUnits(itemPos);
|
||||
//itemPos = ToolBox.GetAttributeVector2(element, "ItemPos", Vector2.Zero);
|
||||
//itemPos = ConvertUnits.ToSimUnits(itemPos);
|
||||
|
||||
itemInterval = ToolBox.GetAttributeVector2(element, "ItemInterval", Vector2.Zero);
|
||||
itemInterval = ConvertUnits.ToSimUnits(itemInterval);
|
||||
//itemInterval = ToolBox.GetAttributeVector2(element, "ItemInterval", Vector2.Zero);
|
||||
//itemInterval = ConvertUnits.ToSimUnits(itemInterval);
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
@@ -106,7 +108,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (contained == null) continue;
|
||||
|
||||
if (contained.body!=null) contained.body.Enabled = !hideItems;
|
||||
if (contained.body!=null) contained.body.Enabled = false;
|
||||
|
||||
RelatedItem ri = containableItems.Find(x => x.MatchesItem(item));
|
||||
if (ri == null) continue;
|
||||
@@ -120,40 +122,74 @@ namespace Subsurface.Items.Components
|
||||
contained.ApplyStatusEffects(ActionType.OnContained, deltaTime);
|
||||
}
|
||||
|
||||
if (hideItems) return;
|
||||
//if (hideItems) return;
|
||||
|
||||
//Vector2 transformedItemPos;
|
||||
//Vector2 transformedItemInterval = itemInterval;
|
||||
////float transformedItemRotation = itemRotation;
|
||||
//if (item.body==null)
|
||||
//{
|
||||
// transformedItemPos = new Vector2(item.Rect.X, item.Rect.Y);
|
||||
// transformedItemPos = ConvertUnits.ToSimUnits(transformedItemPos) + itemPos;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// Matrix transform = Matrix.CreateRotationZ(item.body.Rotation);
|
||||
|
||||
// transformedItemPos = item.body.Position + Vector2.Transform(itemPos, transform);
|
||||
// transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||
// //transformedItemRotation += item.body.Rotation;
|
||||
//}
|
||||
|
||||
//foreach (Item containedItem in inventory.items)
|
||||
//{
|
||||
// if (containedItem == null) continue;
|
||||
|
||||
// Vector2 itemDist = (transformedItemPos - containedItem.body.Position);
|
||||
// Vector2 force = (itemDist - containedItem.body.LinearVelocity * 0.1f) * containedItem.body.Mass * 60.0f;
|
||||
|
||||
// containedItem.body.ApplyForce(force);
|
||||
|
||||
// containedItem.body.SmoothRotate(itemRotation);
|
||||
|
||||
// transformedItemPos += transformedItemInterval;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
base.Draw(spriteBatch);
|
||||
|
||||
if (hideItems) return;
|
||||
|
||||
Vector2 transformedItemPos;
|
||||
Vector2 transformedItemInterval = itemInterval;
|
||||
float currentRotation = itemRotation;
|
||||
//float transformedItemRotation = itemRotation;
|
||||
if (item.body==null)
|
||||
if (item.body == null)
|
||||
{
|
||||
transformedItemPos = new Vector2(item.Rect.X, item.Rect.Y);
|
||||
transformedItemPos = ConvertUnits.ToSimUnits(transformedItemPos) + itemPos;
|
||||
transformedItemPos = transformedItemPos + itemPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
Matrix transform = Matrix.CreateRotationZ(item.body.Rotation);
|
||||
|
||||
transformedItemPos = Vector2.Transform(item.body.Position + itemPos, transform);
|
||||
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||
//transformedItemRotation += item.body.Rotation;
|
||||
transformedItemPos = ConvertUnits.ToDisplayUnits(item.body.Position) + Vector2.Transform(itemPos, transform);
|
||||
transformedItemInterval = Vector2.Transform(transformedItemInterval, transform);
|
||||
currentRotation += item.body.Rotation;
|
||||
}
|
||||
|
||||
foreach (Item containedItem in inventory.items)
|
||||
{
|
||||
if (containedItem == null) continue;
|
||||
|
||||
Vector2 itemDist = (transformedItemPos - containedItem.body.Position);
|
||||
Vector2 force = (itemDist - containedItem.body.LinearVelocity * 0.1f) * containedItem.body.Mass * 60.0f;
|
||||
|
||||
containedItem.body.ApplyForce(force);
|
||||
|
||||
containedItem.body.SmoothRotate(itemRotation);
|
||||
containedItem.sprite.Draw(spriteBatch, new Vector2(transformedItemPos.X, -transformedItemPos.Y), -currentRotation, 1.0f);
|
||||
|
||||
transformedItemPos += transformedItemInterval;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
|
||||
@@ -60,82 +60,30 @@ namespace Subsurface.Items.Components
|
||||
set
|
||||
{
|
||||
isOpen = value;
|
||||
openState = (isOpen) ? 1.0f : 0.0f;
|
||||
OpenState = (isOpen) ? 1.0f : 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
private Rectangle doorRect;
|
||||
|
||||
|
||||
|
||||
public float OpenState
|
||||
{
|
||||
get { return openState; }
|
||||
set
|
||||
{
|
||||
if (openState == value) return;
|
||||
|
||||
float prevValue = openState;
|
||||
openState = MathHelper.Clamp(value, 0.0f, 1.0f);
|
||||
if (openState == prevValue) return;
|
||||
|
||||
|
||||
|
||||
if (window==null)
|
||||
{
|
||||
Rectangle rect = item.Rect;
|
||||
rect.Height = (int)(rect.Height * (1.0f - openState));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Rectangle rect = item.Rect;
|
||||
//rect.Height = (int)(rect.Height * (1.0f - openState));
|
||||
|
||||
Rectangle rect1 = doorRect;
|
||||
rect1.Height = -window.Y;
|
||||
|
||||
rect1.Y += (int)(doorRect.Height * openState);
|
||||
rect1.Height = Math.Max(rect1.Height - (rect1.Y - doorRect.Y), 0);
|
||||
rect1.Y = Math.Min(doorRect.Y, rect1.Y);
|
||||
|
||||
if (rect1.Height == 0)
|
||||
{
|
||||
convexHull.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
convexHull.SetVertices(GetConvexHullCorners(rect1));
|
||||
}
|
||||
|
||||
if (convexHull2 != null)
|
||||
{
|
||||
Rectangle rect2 = doorRect;
|
||||
rect2.Y = rect2.Y + window.Y - window.Height;
|
||||
|
||||
rect2.Y += (int)(doorRect.Height * openState);
|
||||
rect2.Y = Math.Min(doorRect.Y, rect2.Y);
|
||||
rect2.Height = rect2.Y - (doorRect.Y - (int)(doorRect.Height * (1.0f - openState)));
|
||||
convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
||||
|
||||
if (rect2.Height == 0)
|
||||
{
|
||||
convexHull2.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
UpdateConvexHulls();
|
||||
}
|
||||
}
|
||||
|
||||
PhysicsBody body;
|
||||
|
||||
Sprite doorSprite;
|
||||
|
||||
|
||||
public Door(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
@@ -160,7 +108,9 @@ namespace Subsurface.Items.Components
|
||||
ConvertUnits.ToSimUnits(Math.Max(doorRect.Width, 1)),
|
||||
ConvertUnits.ToSimUnits(Math.Max(doorRect.Height, 1)),
|
||||
1.5f));
|
||||
|
||||
|
||||
body.CollisionCategories = Physics.CollisionWall;
|
||||
body.UserData = item;
|
||||
body.BodyType = BodyType.Static;
|
||||
body.SetTransform(
|
||||
ConvertUnits.ToSimUnits(new Vector2(doorRect.Center.X, doorRect.Y - doorRect.Height / 2)),
|
||||
@@ -169,21 +119,69 @@ namespace Subsurface.Items.Components
|
||||
|
||||
|
||||
//string spritePath = Path.GetDirectoryName(item.Prefab.ConfigFile) + "\\"+ ToolBox.GetAttributeString(element, "sprite", "");
|
||||
|
||||
|
||||
|
||||
isActive = true;
|
||||
|
||||
|
||||
|
||||
Vector2[] corners = GetConvexHullCorners(doorRect);
|
||||
|
||||
convexHull = new ConvexHull(corners, Color.Black);
|
||||
if (window!=null) convexHull2 = new ConvexHull(corners, Color.Black);
|
||||
if (window!=null && window!=Rectangle.Empty) convexHull2 = new ConvexHull(corners, Color.Black);
|
||||
|
||||
OpenState = openState;
|
||||
//powerConsumption = -100.0f;
|
||||
UpdateConvexHulls();
|
||||
|
||||
//LinkedGap.Open = openState;
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
private void UpdateConvexHulls()
|
||||
{
|
||||
Rectangle rect = doorRect;
|
||||
|
||||
rect.Height = (int)(rect.Height * (1.0f - openState));
|
||||
if (window.Height == 0 || window.Width == 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//Rectangle rect = item.Rect;
|
||||
//rect.Height = (int)(rect.Height * (1.0f - openState));
|
||||
|
||||
rect.Height = -window.Y;
|
||||
|
||||
rect.Y += (int)(doorRect.Height * openState);
|
||||
rect.Height = Math.Max(rect.Height - (rect.Y - doorRect.Y), 0);
|
||||
rect.Y = Math.Min(doorRect.Y, rect.Y);
|
||||
|
||||
|
||||
if (convexHull2 != null)
|
||||
{
|
||||
Rectangle rect2 = doorRect;
|
||||
rect2.Y = rect2.Y + window.Y - window.Height;
|
||||
|
||||
rect2.Y += (int)(doorRect.Height * openState);
|
||||
rect2.Y = Math.Min(doorRect.Y, rect2.Y);
|
||||
rect2.Height = rect2.Y - (doorRect.Y - (int)(doorRect.Height * (1.0f - openState)));
|
||||
//convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
||||
|
||||
if (rect2.Height == 0)
|
||||
{
|
||||
convexHull2.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
convexHull2.Enabled = true;
|
||||
convexHull2.SetVertices(GetConvexHullCorners(rect2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rect.Height == 0)
|
||||
{
|
||||
convexHull.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
convexHull.Enabled = true;
|
||||
convexHull.SetVertices(GetConvexHullCorners(rect));
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2[] GetConvexHullCorners(Rectangle rect)
|
||||
@@ -212,7 +210,6 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override bool Pick(Character picker)
|
||||
{
|
||||
isActive = true;
|
||||
isOpen = !isOpen;
|
||||
|
||||
return true;
|
||||
@@ -222,22 +219,30 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
OpenState += deltaTime * ((isOpen) ? 3.0f : -3.0f);
|
||||
|
||||
LinkedGap.Open = openState;
|
||||
|
||||
item.SendSignal((isOpen) ? "1" : "0", "state_out");
|
||||
}
|
||||
|
||||
public override void UpdateBroken(float deltaTime, Camera cam)
|
||||
{
|
||||
body.Enabled = false;
|
||||
convexHull.Enabled = false;
|
||||
linkedGap.Open = 1.0f;
|
||||
if (convexHull2 != null) convexHull2.Enabled = false;
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
|
||||
LinkedGap.Open = openState;
|
||||
|
||||
Color color = (item.IsSelected) ? Color.Green : Color.White;
|
||||
color = color * (item.Condition / 100.0f);
|
||||
color.A = 255;
|
||||
|
||||
//prefab.sprite.Draw(spriteBatch, new Vector2(rect.X, -rect.Y), new Vector2(rect.Width, rect.Height), color);
|
||||
|
||||
if (openState == 1.0f)
|
||||
{
|
||||
body.Enabled = false;
|
||||
convexHull.Enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -246,8 +251,6 @@ namespace Subsurface.Items.Components
|
||||
(int)doorSprite.size.X, (int)(doorSprite.size.Y * (1.0f - openState))),
|
||||
color, 0.0f, doorSprite.Origin, 1.0f, SpriteEffects.None, doorSprite.Depth);
|
||||
|
||||
convexHull.Enabled = true;
|
||||
|
||||
if (openState == 0.0f)
|
||||
{
|
||||
body.Enabled = true;
|
||||
@@ -290,7 +293,6 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void ReceiveSignal(string signal, Connection connection, Item sender)
|
||||
{
|
||||
isActive = true;
|
||||
if (connection.name=="toggle")
|
||||
{
|
||||
isOpen = !isOpen;
|
||||
|
||||
@@ -176,54 +176,26 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
//public List<ObjectProperty> GetProperties<T>()
|
||||
//{
|
||||
// List<ObjectProperty> editableProperties = new List<ObjectProperty>();
|
||||
|
||||
// foreach (var property in properties.Values)
|
||||
// {
|
||||
// if (property.Attributes.OfType<T>().Count() > 0) editableProperties.Add(property);
|
||||
// }
|
||||
|
||||
// return editableProperties;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
private int loopingSoundIndex;
|
||||
|
||||
|
||||
public void PlaySound(ActionType type, float volume, Vector2 position, bool loop=false)
|
||||
{
|
||||
|
||||
if (!loop)
|
||||
{
|
||||
List<ItemSound> matchingSounds = sounds.FindAll(x=> x.type == type);
|
||||
|
||||
if (matchingSounds.Count == 0 || item.Prefab.sounds.Count == 0) return;
|
||||
|
||||
int index = Game1.localRandom.Next(Math.Min(matchingSounds.Count,item.Prefab.sounds.Count));
|
||||
if (loop && Sounds.SoundManager.IsPlaying(loopingSoundIndex)) return;
|
||||
|
||||
Sound sound = item.Prefab.sounds[matchingSounds[index].index];
|
||||
List<ItemSound> matchingSounds = sounds.FindAll(x => x.type == type);
|
||||
if (matchingSounds.Count == 0 || item.Prefab.sounds.Count == 0) return;
|
||||
|
||||
sound.Play(volume, matchingSounds[index].range, position);
|
||||
int index = Game1.localRandom.Next(Math.Min(matchingSounds.Count, item.Prefab.sounds.Count));
|
||||
|
||||
Sound sound = item.Prefab.sounds[matchingSounds[index].index];
|
||||
|
||||
if (loop)
|
||||
{
|
||||
loopingSoundIndex = sound.Loop(loopingSoundIndex, volume, position, matchingSounds[index].range);
|
||||
}
|
||||
else
|
||||
{
|
||||
//todo: get rid of copypaste
|
||||
if (!Sounds.SoundManager.IsPlaying(loopingSoundIndex))
|
||||
{
|
||||
List<ItemSound> matchingSounds = sounds.FindAll(x => x.type == type);
|
||||
|
||||
if (matchingSounds.Count == 0 || item.Prefab.sounds.Count == 0) return;
|
||||
|
||||
int index = Game1.localRandom.Next(Math.Min(matchingSounds.Count, item.Prefab.sounds.Count));
|
||||
|
||||
Sound sound = item.Prefab.sounds[matchingSounds[index].index];
|
||||
|
||||
loopingSoundIndex = sound.Loop(loopingSoundIndex, volume, position, matchingSounds[index].range);
|
||||
}
|
||||
}
|
||||
sound.Play(volume, matchingSounds[index].range, position);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Move(Vector2 amount) { }
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
if (picker == null) return false;
|
||||
|
||||
picker.SelectedConstruction = item;
|
||||
//picker.SelectedConstruction = item;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ namespace Subsurface.Items.Components
|
||||
[Editable, HasDefaultValue(10.0f, true)]
|
||||
public float MaxOutPut
|
||||
{
|
||||
set { maxOutput = value; }
|
||||
get { return maxOutput; }
|
||||
}
|
||||
|
||||
@@ -42,21 +43,24 @@ namespace Subsurface.Items.Components
|
||||
|
||||
|
||||
[HasDefaultValue(10.0f, false)]
|
||||
private float Capacity
|
||||
public float Capacity
|
||||
{
|
||||
get { return capacity; }
|
||||
set { capacity = Math.Max(value,1.0f); }
|
||||
}
|
||||
|
||||
[HasDefaultValue(10.0f, false)]
|
||||
private float MaxInput
|
||||
{
|
||||
set { MaxInput = value; }
|
||||
}
|
||||
//[HasDefaultValue(10.0f, false)]
|
||||
//public float MaxInput
|
||||
//{
|
||||
// get { return maxInput; }
|
||||
// set { maxInput = value; }
|
||||
//}
|
||||
|
||||
[HasDefaultValue(10.0f, false)]
|
||||
private float MaxOutput
|
||||
public float MaxRechargeSpeed
|
||||
{
|
||||
set { maxOutput = value; }
|
||||
get { return maxRechargeSpeed; }
|
||||
set { maxRechargeSpeed = Math.Max(value, 1.0f); }
|
||||
}
|
||||
|
||||
public PowerContainer(Item item, XElement element)
|
||||
@@ -65,9 +69,7 @@ namespace Subsurface.Items.Components
|
||||
//capacity = ToolBox.GetAttributeFloat(element, "capacity", 10.0f);
|
||||
//maxRechargeSpeed = ToolBox.GetAttributeFloat(element, "maxinput", 10.0f);
|
||||
//maxOutput = ToolBox.GetAttributeFloat(element, "maxoutput", 10.0f);
|
||||
|
||||
rechargeSpeed = maxRechargeSpeed;
|
||||
|
||||
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
@@ -129,7 +131,7 @@ namespace Subsurface.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
currPowerConsumption = MathHelper.Lerp(currPowerConsumption, rechargeSpeed, 0.05f);
|
||||
currPowerConsumption = MathHelper.Lerp(currPowerConsumption, maxRechargeSpeed*rechargeSpeed, 0.05f);
|
||||
charge += currPowerConsumption*voltage / 3600.0f;
|
||||
}
|
||||
//provide power to the grid
|
||||
@@ -142,10 +144,10 @@ namespace Subsurface.Items.Components
|
||||
return;
|
||||
}
|
||||
|
||||
currPowerConsumption = MathHelper.Lerp(
|
||||
currPowerConsumption,
|
||||
-maxOutput * chargeRate,
|
||||
0.1f);
|
||||
//currPowerConsumption = MathHelper.Lerp(
|
||||
// currPowerConsumption,
|
||||
// -maxOutput * chargeRate,
|
||||
// 0.1f);
|
||||
|
||||
currPowerConsumption = MathHelper.Lerp(
|
||||
currPowerConsumption,
|
||||
|
||||
@@ -49,9 +49,11 @@ namespace Subsurface.Items.Components
|
||||
pt.powerLoad += (fullLoad - pt.powerLoad) / inertia;
|
||||
pt.currPowerConsumption += (-fullPower - pt.currPowerConsumption) / inertia;
|
||||
pt.Item.SendSignal((fullPower / Math.Max(fullLoad,1.0f)).ToString(), "power_out");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//p.Power = fullPower;
|
||||
}
|
||||
}
|
||||
@@ -103,15 +105,15 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
connectedList.Add(powered);
|
||||
//positive power consumption = the construction requires power -> increase load
|
||||
if (powered.PowerConsumption > 0.0f)
|
||||
if (powered.CurrPowerConsumption > 0.0f)
|
||||
{
|
||||
fullLoad += powered.PowerConsumption;
|
||||
fullLoad += powered.CurrPowerConsumption;
|
||||
}
|
||||
else if (powered.PowerConsumption < 0.0f)
|
||||
else if (powered.CurrPowerConsumption < 0.0f)
|
||||
//negative power consumption = the construction is a
|
||||
//generator/battery or another junction box
|
||||
{
|
||||
fullPower -= powered.PowerConsumption;
|
||||
fullPower -= powered.CurrPowerConsumption;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,38 +155,42 @@ namespace Subsurface.Items.Components
|
||||
//f2.Body.ApplyLinearImpulse(force);
|
||||
//f1.Body.ApplyLinearImpulse(-f1.Body.LinearVelocity * f1.Body.Mass);
|
||||
|
||||
float damage = f1.Body.LinearVelocity.Length();
|
||||
//float damage = f1.Body.LinearVelocity.Length();
|
||||
|
||||
Limb limb;
|
||||
Structure structure;
|
||||
if ((limb = (f2.Body.UserData as Limb)) != null)
|
||||
if (attack!=null)
|
||||
{
|
||||
attack.DoDamage(limb.character, item.SimPosition, 0.0f);
|
||||
//limb.Damage += damage;
|
||||
//limb.Bleeding += bleedingDamage;
|
||||
Limb limb;
|
||||
Structure structure;
|
||||
if ((limb = (f2.Body.UserData as Limb)) != null)
|
||||
{
|
||||
attack.DoDamage(limb.character, item.SimPosition, 0.0f);
|
||||
//limb.Damage += damage;
|
||||
//limb.Bleeding += bleedingDamage;
|
||||
|
||||
//if (bleedingDamage>0.0f)
|
||||
//{
|
||||
// for (int i = 0; i < 5; i++ )
|
||||
// {
|
||||
// Game1.particleManager.CreateParticle(limb.SimPosition,
|
||||
// ToolBox.VectorToAngle(-f1.Body.LinearVelocity*0.5f) + ToolBox.RandomFloat(-0.5f, 0.5f),
|
||||
// ToolBox.RandomFloat(1.0f, 3.0f), "blood");
|
||||
// }
|
||||
//if (bleedingDamage>0.0f)
|
||||
//{
|
||||
// for (int i = 0; i < 5; i++ )
|
||||
// {
|
||||
// Game1.particleManager.CreateParticle(limb.SimPosition,
|
||||
// ToolBox.VectorToAngle(-f1.Body.LinearVelocity*0.5f) + ToolBox.RandomFloat(-0.5f, 0.5f),
|
||||
// ToolBox.RandomFloat(1.0f, 3.0f), "blood");
|
||||
// }
|
||||
|
||||
// Game1.particleManager.CreateParticle(limb.SimPosition,
|
||||
// 0.0f,
|
||||
// Vector2.Zero, "waterblood");
|
||||
//}
|
||||
// Game1.particleManager.CreateParticle(limb.SimPosition,
|
||||
// 0.0f,
|
||||
// Vector2.Zero, "waterblood");
|
||||
//}
|
||||
|
||||
//AmbientSoundManager.PlayDamageSound(DamageType.LimbBlunt, damage, limb.body.FarseerBody);
|
||||
//AmbientSoundManager.PlayDamageSound(DamageType.LimbBlunt, damage, limb.body.FarseerBody);
|
||||
}
|
||||
else if ((structure = (f2.Body.UserData as Structure)) != null)
|
||||
{
|
||||
attack.DoDamage(structure, item.SimPosition, 0.0f);
|
||||
|
||||
//AmbientSoundManager.PlayDamageSound(DamageType.StructureBlunt, damage, f2.Body);
|
||||
}
|
||||
}
|
||||
else if ((structure = (f2.Body.UserData as Structure)) != null)
|
||||
{
|
||||
attack.DoDamage(structure, item.SimPosition, 0.0f);
|
||||
|
||||
//AmbientSoundManager.PlayDamageSound(DamageType.StructureBlunt, damage, f2.Body);
|
||||
}
|
||||
|
||||
item.body.FarseerBody.OnCollision -= OnProjectileCollision;
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@ namespace Subsurface.Items.Components
|
||||
Hull hull1, hull2;
|
||||
|
||||
[HasDefaultValue(100.0f, false)]
|
||||
private float MaxFlow
|
||||
{
|
||||
public float MaxFlow
|
||||
{
|
||||
get { return maxFlow; }
|
||||
set { maxFlow = value; }
|
||||
}
|
||||
|
||||
@@ -41,14 +42,14 @@ namespace Subsurface.Items.Components
|
||||
if (voltage < minVoltage) return;
|
||||
|
||||
if (hull2 == null && hull1 == null) return;
|
||||
|
||||
float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage;
|
||||
flow = maxFlow * powerFactor;
|
||||
|
||||
float deltaVolume = flow * ((flowIn) ? 1.0f : -1.0f);
|
||||
hull1.Volume += deltaVolume;
|
||||
if (hull2 != null) hull2.Volume -= deltaVolume;
|
||||
|
||||
float powerFactor = (currPowerConsumption==0.0f) ? 1.0f : voltage;
|
||||
flow = maxFlow * powerFactor;
|
||||
|
||||
voltage = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,10 @@ namespace Subsurface.Items.Components
|
||||
if (powerUpTask==null || powerUpTask.IsFinished)
|
||||
{
|
||||
powerUpTask = new PropertyTask(Game1.gameSession.taskManager, item, IsRunning, 20.0f, "Power up the reactor");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
item.Condition -= temperature*deltaTime*0.00005f;
|
||||
|
||||
if (temperature > shutDownTemp)
|
||||
@@ -157,7 +158,7 @@ namespace Subsurface.Items.Components
|
||||
FissionRate = Math.Max(fissionRate, heat / 200.0f);
|
||||
|
||||
//the power generated by the reactor is equal to the temperature
|
||||
currPowerConsumption = -temperature;
|
||||
currPowerConsumption = -temperature*powerPerTemp;
|
||||
|
||||
if (item.currentHull != null)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
gunJoint.Length = Math.Max(gunJoint.Length-0.003f,0.01f);
|
||||
gunJoint.Length = Math.Max(gunJoint.Length-0.01f,0.01f);
|
||||
gunJoint.Frequency = 30;
|
||||
gunJoint.DampingRatio = 0.05f;
|
||||
//gunJoint.MotorEnabled = true;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -32,7 +34,12 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawHUD(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Character character)
|
||||
public override void Move(Vector2 amount)
|
||||
{
|
||||
base.Move(amount);
|
||||
}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
if (user!=character) return;
|
||||
Connection.DrawConnections(spriteBatch, this, character);
|
||||
@@ -44,8 +51,6 @@ namespace Subsurface.Items.Components
|
||||
|
||||
foreach (Connection c in connections)
|
||||
{
|
||||
//XElement newElement = new XElement(c.isOutput ? "output" : "input", new XAttribute("name", c.name));
|
||||
|
||||
c.Save(componentElement);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,20 +11,23 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
class Wire : ItemComponent
|
||||
{
|
||||
const float nodeDistance = 128.0f;
|
||||
const float nodeDistance = 32.0f;
|
||||
const float heightFromFloor = 128.0f;
|
||||
|
||||
static Sprite wireSprite;
|
||||
|
||||
List<Vector2> nodes;
|
||||
|
||||
|
||||
Connection[] connections;
|
||||
|
||||
private Vector2 newNodePos;
|
||||
|
||||
public Wire(Item item, XElement element)
|
||||
: base(item, element)
|
||||
{
|
||||
if (wireSprite==null)
|
||||
if (wireSprite == null)
|
||||
{
|
||||
wireSprite = new Sprite("Content/Items/wireHorizontal.png",new Vector2(0.5f,0.5f));
|
||||
wireSprite = new Sprite("Content/Items/wireHorizontal.png", new Vector2(0.5f, 0.5f));
|
||||
wireSprite.Depth = 0.85f;
|
||||
}
|
||||
|
||||
@@ -35,9 +38,9 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public Connection OtherConnection(Connection connection)
|
||||
{
|
||||
if (connection==null) return null;
|
||||
if (connection==connections[0]) return connections[1];
|
||||
if (connection==connections[1]) return connections[0];
|
||||
if (connection == null) return null;
|
||||
if (connection == connections[0]) return connections[1];
|
||||
if (connection == connections[1]) return connections[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -49,7 +52,7 @@ namespace Subsurface.Items.Components
|
||||
}
|
||||
|
||||
public void Connect(Connection newConnection, bool addNode = true)
|
||||
{
|
||||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (connections[i] == newConnection) return;
|
||||
@@ -62,8 +65,8 @@ namespace Subsurface.Items.Components
|
||||
connections[i] = newConnection;
|
||||
|
||||
if (!addNode) break;
|
||||
|
||||
if (i==0)
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
nodes.Insert(0, newConnection.Item.Position);
|
||||
}
|
||||
@@ -71,16 +74,18 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
nodes.Add(newConnection.Item.Position);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (connections[0]!=null && connections[1]!=null)
|
||||
if (connections[0] != null && connections[1] != null)
|
||||
{
|
||||
item.Drop(null, false);
|
||||
item.body.Enabled = false;
|
||||
|
||||
isActive = false;
|
||||
|
||||
CleanNodes();
|
||||
}
|
||||
|
||||
@@ -98,61 +103,80 @@ namespace Subsurface.Items.Components
|
||||
public override void Unequip(Character character)
|
||||
{
|
||||
ClearConnections();
|
||||
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
if (nodes.Count == 0) return;
|
||||
|
||||
if (Math.Abs(item.Position.X-nodes[nodes.Count-1].X)>nodeDistance)
|
||||
{
|
||||
nodes.Add(new Vector2(
|
||||
ToolBox.Round(item.Position.X, Map.gridSize.X),
|
||||
nodes[nodes.Count - 1].Y));
|
||||
item.FindHull();
|
||||
|
||||
item.NewComponentEvent(this, true);
|
||||
}
|
||||
else if (Math.Abs(item.Position.Y-nodes[nodes.Count-1].Y)>nodeDistance)
|
||||
Vector2 position = item.Position;
|
||||
position.X = ToolBox.Round(item.Position.X, nodeDistance);
|
||||
if (item.currentHull == null)
|
||||
{
|
||||
nodes.Add(new Vector2(nodes[nodes.Count - 1].X,
|
||||
ToolBox.Round(item.Position.Y, Map.gridSize.Y)));
|
||||
|
||||
item.NewComponentEvent(this, true);
|
||||
position.Y = ToolBox.Round(item.Position.Y, nodeDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
position.Y -= item.currentHull.Rect.Y - item.currentHull.Rect.Height;
|
||||
position.Y = Math.Max(ToolBox.Round(position.Y, nodeDistance), heightFromFloor);
|
||||
position.Y += item.currentHull.Rect.Y - item.currentHull.Rect.Height;
|
||||
}
|
||||
|
||||
newNodePos = position;
|
||||
|
||||
//if (Vector2.Distance(position, nodes[nodes.Count - 1]) > nodeDistance*10)
|
||||
//{
|
||||
// nodes.Add(position);
|
||||
|
||||
// item.NewComponentEvent(this, true);
|
||||
//}
|
||||
//else if (Math.Abs(position.Y - nodes[nodes.Count - 1].Y) > nodeDistance)
|
||||
//{
|
||||
// nodes.Add(new Vector2(nodes[nodes.Count - 1].X,
|
||||
// position.Y));
|
||||
|
||||
// item.NewComponentEvent(this, true);
|
||||
//}
|
||||
}
|
||||
|
||||
//public override bool Use(Character character = null)
|
||||
//{
|
||||
// Vector2 nodePos = item.Position;
|
||||
// ToolBox.Round(nodePos.X, Map.gridSize.X);
|
||||
// ToolBox.Round(nodePos.Y, Map.gridSize.Y);
|
||||
public override bool Use(Character character = null)
|
||||
{
|
||||
if (newNodePos!= Vector2.Zero && nodes.Count>0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
|
||||
{
|
||||
nodes.Add(newNodePos);
|
||||
newNodePos = Vector2.Zero;
|
||||
}
|
||||
|
||||
// nodes.Add(nodePos);
|
||||
|
||||
// return true;
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void SecondaryUse(Character character = null)
|
||||
{
|
||||
if (nodes.Count > 0)
|
||||
if (nodes.Count > 1)
|
||||
{
|
||||
nodes.RemoveAt(nodes.Count - 1);
|
||||
item.NewComponentEvent(this, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override bool Pick(Character picker)
|
||||
{
|
||||
ClearConnections();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private void ClearConnections()
|
||||
{
|
||||
nodes.Clear();
|
||||
|
||||
for (int i = 0; i < 2; i++ )
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
if (connections[i] == null) continue;
|
||||
int wireIndex = connections[i].FindWireIndex(item);
|
||||
@@ -168,8 +192,8 @@ namespace Subsurface.Items.Components
|
||||
{
|
||||
for (int i = nodes.Count - 2; i > 0; i--)
|
||||
{
|
||||
if ((nodes[i-1].X == nodes[i].X || nodes[i-1].Y == nodes[i].Y) &&
|
||||
(nodes[i+1].X == nodes[i].X || nodes[i+1].Y == nodes[i].Y))
|
||||
if ((nodes[i - 1].X == nodes[i].X || nodes[i - 1].Y == nodes[i].Y) &&
|
||||
(nodes[i + 1].X == nodes[i].X || nodes[i + 1].Y == nodes[i].Y))
|
||||
{
|
||||
if (Vector2.Distance(nodes[i - 1], nodes[i]) == Vector2.Distance(nodes[i + 1], nodes[i]))
|
||||
{
|
||||
@@ -199,29 +223,38 @@ namespace Subsurface.Items.Components
|
||||
|
||||
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
|
||||
{
|
||||
if (nodes.Count == 0) return;
|
||||
|
||||
for (int i = 0; i < nodes.Count; i++)
|
||||
{
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)nodes[i].X, (int)-nodes[i].Y, 5, 5), Color.DarkGray, true, wireSprite.Depth - 0.01f);
|
||||
}
|
||||
|
||||
for (int i = 1; i<nodes.Count; i++)
|
||||
for (int i = 1; i < nodes.Count; i++)
|
||||
{
|
||||
DrawSection(spriteBatch, nodes[i], nodes[i - 1], i);
|
||||
DrawSection(spriteBatch, nodes[i], nodes[i - 1], i, Color.White);
|
||||
}
|
||||
|
||||
if (isActive && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
|
||||
{
|
||||
DrawSection(spriteBatch, nodes[nodes.Count - 1], newNodePos, nodes.Count, Color.White * 0.5f);
|
||||
//nodes.Add(newNodePos);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, int i)
|
||||
private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, int i, Color color)
|
||||
{
|
||||
start.Y = -start.Y;
|
||||
end.Y = -end.Y;
|
||||
|
||||
|
||||
spriteBatch.Draw(wireSprite.Texture,
|
||||
start, null, Color.White,
|
||||
start, null, color,
|
||||
ToolBox.VectorToAngle(end - start),
|
||||
new Vector2(0.0f, wireSprite.size.Y / 2.0f),
|
||||
new Vector2((Vector2.Distance(start, end)) / wireSprite.Texture.Width, 0.3f),
|
||||
SpriteEffects.None,
|
||||
wireSprite.Depth +0.1f + i * 0.00001f);
|
||||
wireSprite.Depth + 0.1f + i * 0.00001f);
|
||||
}
|
||||
|
||||
public override XElement Save(XElement parentElement)
|
||||
@@ -230,7 +263,7 @@ namespace Subsurface.Items.Components
|
||||
|
||||
if (nodes == null || nodes.Count == 0) return componentElement;
|
||||
|
||||
string[] nodeCoords = new string[nodes.Count()*2];
|
||||
string[] nodeCoords = new string[nodes.Count() * 2];
|
||||
for (int i = 0; i < nodes.Count(); i++)
|
||||
{
|
||||
nodeCoords[i * 2] = nodes[i].X.ToString(CultureInfo.InvariantCulture);
|
||||
@@ -250,7 +283,7 @@ namespace Subsurface.Items.Components
|
||||
if (nodeString == "") return;
|
||||
|
||||
string[] nodeCoords = nodeString.Split(';');
|
||||
for (int i = 0; i<nodeCoords.Length/2; i++)
|
||||
for (int i = 0; i < nodeCoords.Length / 2; i++)
|
||||
{
|
||||
float x = 0.0f, y = 0.0f;
|
||||
|
||||
|
||||
@@ -64,6 +64,11 @@ namespace Subsurface
|
||||
set { condition = MathHelper.Clamp(value, 0.0f, 100.0f); }
|
||||
}
|
||||
|
||||
public float Health
|
||||
{
|
||||
get { return condition; }
|
||||
}
|
||||
|
||||
[Editable, HasDefaultValue("", true)]
|
||||
public string Tags
|
||||
{
|
||||
@@ -205,6 +210,11 @@ namespace Subsurface
|
||||
case "trigger":
|
||||
case "sprite":
|
||||
break;
|
||||
case "aitarget":
|
||||
aiTarget = new AITarget(this);
|
||||
aiTarget.SightRange = ToolBox.GetAttributeFloat(subElement, "sightrange", 1000.0f);
|
||||
aiTarget.SoundRange = ToolBox.GetAttributeFloat(subElement, "soundrange", 0.0f);
|
||||
break;
|
||||
default:
|
||||
ItemComponent ic = ItemComponent.Load(subElement, this, prefab.ConfigFile);
|
||||
if (ic == null) break;
|
||||
@@ -285,7 +295,7 @@ namespace Subsurface
|
||||
foreach (Item item in itemList) item.FindHull();
|
||||
}
|
||||
|
||||
protected virtual Hull FindHull()
|
||||
public virtual Hull FindHull()
|
||||
{
|
||||
currentHull = Hull.FindHull((body == null) ? Position : ConvertUnits.ToDisplayUnits(body.Position), currentHull);
|
||||
return currentHull;
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Subsurface
|
||||
protected AITarget aiTarget;
|
||||
//protected float soundRange;
|
||||
//protected float sightRange;
|
||||
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return id; }
|
||||
|
||||
@@ -49,10 +49,9 @@ namespace Subsurface
|
||||
{
|
||||
for (int i = 0; i<range*10; i++)
|
||||
{
|
||||
Game1.particleManager.CreateParticle(position,
|
||||
ToolBox.RandomFloat(0.0f,3.14f),
|
||||
Vector2.Normalize(new Vector2(ToolBox.RandomFloat(-1.0f, 1.0f), ToolBox.RandomFloat(-1.0f, 1.0f))) * ToolBox.RandomFloat(3.0f,4.0f),
|
||||
"explosionfire");
|
||||
Game1.particleManager.CreateParticle("explosionfire", position,
|
||||
Vector2.Normalize(new Vector2(ToolBox.RandomFloat(-1.0f, 1.0f), ToolBox.RandomFloat(-1.0f, 1.0f))) * ToolBox.RandomFloat(3.0f, 4.0f),
|
||||
0.0f);
|
||||
}
|
||||
|
||||
Vector2 displayPosition = ConvertUnits.ToDisplayUnits(position);
|
||||
|
||||
@@ -96,68 +96,84 @@ namespace Subsurface
|
||||
|
||||
private void FindHulls()
|
||||
{
|
||||
Hull hull1 = null, hull2 = null;
|
||||
Hull[] hulls = new Hull[2];
|
||||
|
||||
linkedTo.Clear();
|
||||
|
||||
foreach (Hull h in Hull.hullList)
|
||||
{
|
||||
if (!Map.RectsOverlap(h.Rect, rect)) continue;
|
||||
if (!Map.RectsOverlap(h.Rect, rect, false)) continue;
|
||||
|
||||
//if the gap is inside the hull completely, ignore it
|
||||
if (rect.X > h.Rect.X && rect.X + rect.Width < h.Rect.X+h.Rect.Width &&
|
||||
rect.Y < h.Rect.Y && rect.Y - rect.Height > h.Rect.Y - h.Rect.Height) continue;
|
||||
|
||||
if (hull1 == null)
|
||||
|
||||
for (int i = 0; i < 2; i++ )
|
||||
{
|
||||
hull1 = h;
|
||||
}
|
||||
else
|
||||
{
|
||||
hull2 = h;
|
||||
if (hulls[i] != null) continue;
|
||||
hulls[i] = h;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hulls[1] != null) break;
|
||||
}
|
||||
|
||||
if (hull1 == null && hull2 == null) return;
|
||||
if (hulls[0] == null && hulls[1] == null) return;
|
||||
|
||||
if (hull1 != null && hull2 != null)
|
||||
if (hulls[0]!=null && hulls[1]!=null)
|
||||
{
|
||||
if (isHorizontal)
|
||||
if ((isHorizontal && hulls[0].Rect.X > hulls[1].Rect.X) || (!isHorizontal && hulls[0].Rect.Y < hulls[1].Rect.Y))
|
||||
{
|
||||
//make sure that water1 is the lefthand room
|
||||
//or that water2 is null if the gap doesn't lead to another room
|
||||
if (hull1.Rect.X < hull2.Rect.X)
|
||||
{
|
||||
linkedTo.Add(hull1);
|
||||
linkedTo.Add(hull2);
|
||||
}
|
||||
else
|
||||
{
|
||||
linkedTo.Add(hull2);
|
||||
linkedTo.Add(hull1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//make sure that water1 is the room on the top
|
||||
//or that water2 is null if the gap doesn't lead to another room
|
||||
if (hull1.Rect.Y > hull2.Rect.Y)
|
||||
{
|
||||
linkedTo.Add(hull1);
|
||||
linkedTo.Add(hull2);
|
||||
}
|
||||
else
|
||||
{
|
||||
linkedTo.Add(hull2);
|
||||
linkedTo.Add(hull1);
|
||||
}
|
||||
//make sure that hull1 is the lefthand room if the gap is horizontal,
|
||||
//or that hull1 is the upper hull if the gap is vertical
|
||||
|
||||
Hull temp = hulls[0];
|
||||
hulls[0] = hulls[1];
|
||||
hulls[1] = temp;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
linkedTo.Add(hull1);
|
||||
}
|
||||
|
||||
linkedTo.Add(hulls[0]);
|
||||
if (hulls[1] != null) linkedTo.Add(hulls[1]);
|
||||
|
||||
//if (hull1 != null && hull2 != null)
|
||||
//{
|
||||
// if (isHorizontal)
|
||||
// {
|
||||
// //make sure that water1 is the lefthand room
|
||||
// //or that water2 is null if the gap doesn't lead to another room
|
||||
// if (hull1.Rect.X < hull2.Rect.X)
|
||||
// {
|
||||
// linkedTo.Add(hull1);
|
||||
// linkedTo.Add(hull2);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// linkedTo.Add(hull2);
|
||||
// linkedTo.Add(hull1);
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //make sure that water1 is the room on the top
|
||||
// //or that water2 is null if the gap doesn't lead to another room
|
||||
// if (hull1.Rect.Y > hull2.Rect.Y)
|
||||
// {
|
||||
// linkedTo.Add(hull1);
|
||||
// linkedTo.Add(hull2);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// linkedTo.Add(hull2);
|
||||
// linkedTo.Add(hull1);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// linkedTo.Add(hull1);
|
||||
//}
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch sb, bool editing)
|
||||
@@ -244,22 +260,25 @@ namespace Subsurface
|
||||
{
|
||||
pos.Y = ConvertUnits.ToSimUnits(MathHelper.Clamp(lowerSurface, rect.Y-rect.Height, rect.Y));
|
||||
|
||||
Game1.particleManager.CreateParticle(new Vector2(pos.X, pos.Y - ToolBox.RandomFloat(0.0f, 0.1f)),
|
||||
0.0f, new Vector2(flowForce.X * ToolBox.RandomFloat(0.005f, 0.007f), flowForce.Y * ToolBox.RandomFloat(0.005f, 0.007f)), "watersplash");
|
||||
Game1.particleManager.CreateParticle("watersplash",
|
||||
new Vector2(pos.X, pos.Y - ToolBox.RandomFloat(0.0f, 0.1f)),
|
||||
new Vector2(flowForce.X * ToolBox.RandomFloat(0.005f, 0.007f), flowForce.Y * ToolBox.RandomFloat(0.005f, 0.007f)));
|
||||
|
||||
pos.Y = ConvertUnits.ToSimUnits(ToolBox.RandomFloat(lowerSurface, rect.Y - rect.Height));
|
||||
Game1.particleManager.CreateParticle(pos, 0.0f, flowForce / 200.0f, "bubbles");
|
||||
Game1.particleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos.Y += Math.Sign(flowForce.Y) * ConvertUnits.ToSimUnits(rect.Height / 2.0f);
|
||||
for (int i = 0; i < rect.Width; i += (int)ToolBox.RandomFloat(20, 50))
|
||||
for (int i = 0; i < rect.Width; i += (int)ToolBox.RandomFloat(80, 100))
|
||||
{
|
||||
pos.X = ConvertUnits.ToSimUnits(ToolBox.RandomFloat(rect.X, rect.X+rect.Width));
|
||||
Game1.particleManager.CreateParticle(pos,
|
||||
0.0f, new Vector2(flowForce.X * ToolBox.RandomFloat(0.005f, 0.008f), flowForce.Y * ToolBox.RandomFloat(0.005f, 0.008f)), "watersplash");
|
||||
Subsurface.Particles.Particle splash = Game1.particleManager.CreateParticle("watersplash", pos,
|
||||
new Vector2(flowForce.X * ToolBox.RandomFloat(0.005f, 0.008f), flowForce.Y * ToolBox.RandomFloat(0.005f, 0.008f)));
|
||||
|
||||
Game1.particleManager.CreateParticle(pos, ToolBox.VectorToAngle(flowForce), flowForce / 200.0f, "bubbles");
|
||||
if (splash!=null) splash.Size = splash.Size * MathHelper.Clamp(rect.Width / 50.0f, 0.8f, 4.0f);
|
||||
|
||||
Game1.particleManager.CreateParticle("bubbles", pos, flowForce / 200.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,8 +212,9 @@ namespace Subsurface
|
||||
float maxDelta = Math.Max(Math.Abs(rightDelta[i]), Math.Abs(leftDelta[i]));
|
||||
if (maxDelta > ToolBox.RandomFloat(0.2f,10.0f))
|
||||
{
|
||||
Game1.particleManager.CreateParticle(ConvertUnits.ToSimUnits(new Vector2(rect.X + WaveWidth * i,surface + waveY[i])),
|
||||
ToolBox.RandomFloat(0.0f,6.2f), new Vector2(0.0f, -0.5f), "mist");
|
||||
Game1.particleManager.CreateParticle("mist",
|
||||
ConvertUnits.ToSimUnits(new Vector2(rect.X + WaveWidth * i,surface + waveY[i])),
|
||||
new Vector2(0.0f, -0.5f));
|
||||
}
|
||||
|
||||
waveY[i] = waveY[i] + waveVel[i];
|
||||
|
||||
@@ -4,17 +4,16 @@ namespace Subsurface
|
||||
{
|
||||
interface IDamageable
|
||||
{
|
||||
//float Damage
|
||||
//{
|
||||
// get;
|
||||
// set;
|
||||
//}
|
||||
|
||||
Vector2 SimPosition
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
float Health
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
void AddDamage(Vector2 position, float amount, float bleedingAmount, float stun);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +116,19 @@ namespace Subsurface
|
||||
&& pos.Y < rect.Y && pos.Y > rect.Y - rect.Height);
|
||||
}
|
||||
|
||||
public static bool RectsOverlap(Rectangle rect1, Rectangle rect2)
|
||||
public static bool RectsOverlap(Rectangle rect1, Rectangle rect2, bool inclusive=true)
|
||||
{
|
||||
return !(rect1.X > rect2.X + rect2.Width || rect1.X + rect1.Width < rect2.X ||
|
||||
rect1.Y < rect2.Y - rect2.Height || rect1.Y - rect1.Height > rect2.Y);
|
||||
if (inclusive)
|
||||
{
|
||||
return !(rect1.X > rect2.X + rect2.Width || rect1.X + rect1.Width < rect2.X ||
|
||||
rect1.Y < rect2.Y - rect2.Height || rect1.Y - rect1.Height > rect2.Y);
|
||||
}
|
||||
else
|
||||
{
|
||||
return !(rect1.X >= rect2.X + rect2.Width || rect1.X + rect1.Width <= rect2.X ||
|
||||
rect1.Y <= rect2.Y - rect2.Height || rect1.Y - rect1.Height >= rect2.Y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Body PickBody(Vector2 rayStart, Vector2 rayEnd, List<Body> ignoredBodies = null)
|
||||
@@ -149,9 +158,9 @@ namespace Subsurface
|
||||
}
|
||||
|
||||
|
||||
public static Structure CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
|
||||
public static Body CheckVisibility(Vector2 rayStart, Vector2 rayEnd)
|
||||
{
|
||||
Structure closestStructure = null;
|
||||
Body closestBody = null;
|
||||
float closestFraction = 1.0f;
|
||||
|
||||
if (Vector2.Distance(rayStart,rayEnd)<0.01f)
|
||||
@@ -174,7 +183,7 @@ namespace Subsurface
|
||||
|
||||
if (fraction < closestFraction)
|
||||
{
|
||||
if (structure != null) closestStructure = structure;
|
||||
closestBody = fixture.Body;
|
||||
closestFraction = fraction;
|
||||
}
|
||||
return closestFraction;
|
||||
@@ -184,7 +193,7 @@ namespace Subsurface
|
||||
|
||||
lastPickedPosition = rayStart + (rayEnd - rayStart) * closestFraction;
|
||||
lastPickedFraction = closestFraction;
|
||||
return closestStructure;
|
||||
return closestBody;
|
||||
}
|
||||
|
||||
public static Body PickBody(Vector2 point)
|
||||
@@ -284,8 +293,17 @@ namespace Subsurface
|
||||
Clear();
|
||||
filePath = file;
|
||||
XDocument doc = null;
|
||||
string extension = "";
|
||||
|
||||
string extension = Path.GetExtension(file);
|
||||
try
|
||||
{
|
||||
extension = Path.GetExtension(file);
|
||||
}
|
||||
catch
|
||||
{
|
||||
DebugConsole.ThrowError("Couldn't load map ''" + file + "! (Unrecognized file extension)");
|
||||
return;
|
||||
}
|
||||
|
||||
if (extension==".gz")
|
||||
{
|
||||
|
||||
@@ -88,6 +88,11 @@ namespace Subsurface
|
||||
get { return sections.Length; }
|
||||
}
|
||||
|
||||
public float Health
|
||||
{
|
||||
get { return prefab.MaxHealth; }
|
||||
}
|
||||
|
||||
|
||||
public override void Move(Vector2 amount)
|
||||
{
|
||||
@@ -380,7 +385,7 @@ namespace Subsurface
|
||||
int i = FindSectionIndex(ConvertUnits.ToDisplayUnits(position));
|
||||
if (i == -1) return;
|
||||
|
||||
Game1.particleManager.CreateParticle(ConvertUnits.ToSimUnits(SectionPosition(i)), 0.0f, 0.0f, "dustcloud");
|
||||
Game1.particleManager.CreateParticle("dustcloud", ConvertUnits.ToSimUnits(SectionPosition(i)), 0.0f, 0.0f);
|
||||
|
||||
|
||||
AddDamage(i, amount);
|
||||
|
||||
@@ -31,12 +31,18 @@ namespace Subsurface.Particles
|
||||
private Vector2 drawPosition;
|
||||
|
||||
private float checkCollisionTimer;
|
||||
|
||||
|
||||
public bool InWater
|
||||
{
|
||||
get { return prefab.inWater; }
|
||||
}
|
||||
|
||||
public Vector2 yLimits
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public Vector2 Size
|
||||
{
|
||||
get { return size; }
|
||||
@@ -49,7 +55,7 @@ namespace Subsurface.Particles
|
||||
set { velocityChange = value; }
|
||||
}
|
||||
|
||||
public void Init(Vector2 position, float rotation, Vector2 speed, ParticlePrefab prefab)
|
||||
public void Init(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation)
|
||||
{
|
||||
this.prefab = prefab;
|
||||
|
||||
@@ -73,13 +79,13 @@ namespace Subsurface.Particles
|
||||
|
||||
rand = (float)Game1.localRandom.NextDouble();
|
||||
sizeChange = prefab.sizeChangeMin + (prefab.sizeChangeMax - prefab.sizeChangeMin) * rand;
|
||||
|
||||
|
||||
yLimits = Vector2.Zero;
|
||||
|
||||
color = prefab.startColor;
|
||||
alpha = prefab.startAlpha;
|
||||
|
||||
velocityChange = prefab.velocityChange;
|
||||
|
||||
velocityChange = prefab.velocityChange;
|
||||
}
|
||||
|
||||
public bool Update(float deltaTime)
|
||||
@@ -110,6 +116,14 @@ namespace Subsurface.Particles
|
||||
color.G / 255.0f + prefab.colorChange.Y * deltaTime,
|
||||
color.B / 255.0f + prefab.colorChange.Z * deltaTime);
|
||||
|
||||
if (yLimits!=Vector2.Zero)
|
||||
{
|
||||
if (position.Y>yLimits.X || position.Y<yLimits.Y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (prefab.deleteOnHit)
|
||||
{
|
||||
if (checkCollisionTimer > 0.0f)
|
||||
|
||||
@@ -40,12 +40,12 @@ namespace Subsurface.Particles
|
||||
}
|
||||
}
|
||||
|
||||
public Particle CreateParticle(Vector2 position, float angle, float speed, string prefabName)
|
||||
public Particle CreateParticle(string prefabName, Vector2 position, float angle, float speed)
|
||||
{
|
||||
return CreateParticle(position, angle, new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * speed, prefabName);
|
||||
return CreateParticle(prefabName, position, new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle)) * speed, angle);
|
||||
}
|
||||
|
||||
public Particle CreateParticle(Vector2 position, float rotation, Vector2 speed, string prefabName)
|
||||
public Particle CreateParticle(string prefabName, Vector2 position, Vector2 speed, float rotation=0.0f)
|
||||
{
|
||||
ParticlePrefab prefab;
|
||||
prefabs.TryGetValue(prefabName, out prefab);
|
||||
@@ -56,17 +56,17 @@ namespace Subsurface.Particles
|
||||
return null;
|
||||
}
|
||||
|
||||
return CreateParticle(position, rotation, speed, prefab);
|
||||
return CreateParticle(prefab, position, speed, rotation);
|
||||
}
|
||||
|
||||
public Particle CreateParticle(Vector2 position, float rotation, Vector2 speed, ParticlePrefab prefab)
|
||||
public Particle CreateParticle(ParticlePrefab prefab, Vector2 position, Vector2 speed, float rotation=0.0f)
|
||||
{
|
||||
if (!Map.RectContains(cam.WorldView, ConvertUnits.ToDisplayUnits(position))) return null;
|
||||
if (particleCount >= MaxParticles) return null;
|
||||
|
||||
if (particles[particleCount] == null) particles[particleCount] = new Particle();
|
||||
|
||||
particles[particleCount].Init(position, rotation, speed, prefab);
|
||||
particles[particleCount].Init(prefab, position, speed, rotation);
|
||||
|
||||
particleCount++;
|
||||
|
||||
|
||||
@@ -80,14 +80,14 @@ namespace Subsurface
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 0, 200, 25), "Crew:", Color.Transparent, Color.White, Alignment.Left, rightPanel[0]);
|
||||
|
||||
characterList = new GUIListBox(new Rectangle(0, 30, 300, 400), Color.White, rightPanel[0]);
|
||||
characterList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, rightPanel[0]);
|
||||
|
||||
//---------------------------------------
|
||||
|
||||
rightPanel[1] = new GUIFrame(panelRect, GUI.style.backGroundColor);
|
||||
rightPanel[1].Padding = GUI.style.smallPadding;
|
||||
|
||||
hireList = new GUIListBox(new Rectangle(0, 30, 300, 400), Color.White, Alignment.Left, rightPanel[1]);
|
||||
hireList = new GUIListBox(new Rectangle(0, 30, 300, 0), Color.White, Alignment.Left, rightPanel[1]);
|
||||
|
||||
hireList.OnSelected = HireCharacter;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subsurface_contentContent",
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Subsurface_content", "Subsurface_content\Subsurface_content\Subsurface_content.csproj", "{1E6BF44D-6E31-40CC-8321-3D5958C983E7}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EA5F5518-C0B6-49C4-A421-927EE4391842}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Performance1.psess = Performance1.psess
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Android|Any CPU = Android|Any CPU
|
||||
@@ -161,4 +166,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Binary file not shown.
@@ -7,7 +7,7 @@
|
||||
<Importer>FontDescriptionImporter</Importer>
|
||||
<Processor>FontDescriptionProcessor</Processor>
|
||||
<Options>None</Options>
|
||||
<Output>C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\bin\PSM\Content\SpriteFont1.xnb</Output>
|
||||
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\PSM\Content\SpriteFont1.xnb</Output>
|
||||
<Time>2015-04-14T20:09:38.363195+03:00</Time>
|
||||
</Item>
|
||||
<BuildSuccessful>true</BuildSuccessful>
|
||||
@@ -17,10 +17,10 @@
|
||||
<TargetProfile>HiDef</TargetProfile>
|
||||
<BuildConfiguration>PSM</BuildConfiguration>
|
||||
<CompressContent>false</CompressContent>
|
||||
<RootDirectory>C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_contentContent\</RootDirectory>
|
||||
<LoggerRootDirectory>C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\</LoggerRootDirectory>
|
||||
<IntermediateDirectory>C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\obj\PSM\</IntermediateDirectory>
|
||||
<OutputDirectory>C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\bin\PSM\Content\</OutputDirectory>
|
||||
<RootDirectory>E:\Subsurface\Subsurface_content\Subsurface_contentContent\</RootDirectory>
|
||||
<LoggerRootDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\</LoggerRootDirectory>
|
||||
<IntermediateDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\obj\PSM\</IntermediateDirectory>
|
||||
<OutputDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\bin\PSM\Content\</OutputDirectory>
|
||||
</Settings>
|
||||
<Assemblies>
|
||||
<Assembly>
|
||||
|
||||
Binary file not shown.
@@ -196,3 +196,9 @@ C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\bi
|
||||
C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\obj\PSM\Subsurface_content.csprojResolveAssemblyReference.cache
|
||||
C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
|
||||
C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_content\obj\PSM\IgnoreMe.dll
|
||||
E:\Subsurface\Subsurface_content\Subsurface_content\bin\PSM\Content\SpriteFont1.xnb
|
||||
E:\Subsurface\Subsurface_content\Subsurface_content\bin\PSM\Content\SpriteFont1.spritefont
|
||||
E:\Subsurface\Subsurface_content\Subsurface_content\bin\PSM\IgnoreMe.dll
|
||||
E:\Subsurface\Subsurface_content\Subsurface_content\obj\PSM\Subsurface_content.csprojResolveAssemblyReference.cache
|
||||
E:\Subsurface\Subsurface_content\Subsurface_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
|
||||
E:\Subsurface\Subsurface_content\Subsurface_content\obj\PSM\IgnoreMe.dll
|
||||
|
||||
Binary file not shown.
@@ -30,3 +30,4 @@ C:\Users\Joonas\Desktop\Subsurface_3004\Subsurface – Kopio\Subsurface_content\
|
||||
C:\Users\Joonas\Desktop\Subsurface_0205\Subsurface_content\Subsurface_contentContent\obj\PSM\Subsurface_contentContent.contentprojResolveAssemblyReference.cache
|
||||
C:\Users\Joonas\Desktop\Subsurface_0805\Subsurface_0205\Subsurface_content\Subsurface_contentContent\obj\PSM\Subsurface_contentContent.contentprojResolveAssemblyReference.cache
|
||||
C:\Users\Joonas\Desktop\Subsurface_1005\Subsurface_content\Subsurface_contentContent\obj\PSM\Subsurface_contentContent.contentprojResolveAssemblyReference.cache
|
||||
E:\Subsurface\Subsurface_content\Subsurface_contentContent\obj\PSM\Subsurface_contentContent.contentprojResolveAssemblyReference.cache
|
||||
|
||||
Reference in New Issue
Block a user