Merge branch 'networkFixes' into черешня
# Conflicts: # DangerousD/Content/Content.mgcb # DangerousD/GameCore/GameObjects/LivingEntities/Player/Player.cs
This commit is contained in:
commit
5e804df2b5
4 changed files with 57 additions and 17 deletions
|
@ -237,7 +237,7 @@
|
||||||
/build:sliderBackground.png
|
/build:sliderBackground.png
|
||||||
|
|
||||||
|
|
||||||
#begin SmokeAnimation2.png
|
#begin smokeAnimation2.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
|
|
@ -348,11 +348,6 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (AppManager.Instance.multiPlayerStatus != MultiPlayerStatus.SinglePlayer)
|
|
||||||
{
|
|
||||||
NetworkTask task = new NetworkTask(id, Pos);
|
|
||||||
AppManager.Instance.NetworkTasks.Add(task);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void MoveDown()
|
public void MoveDown()
|
||||||
{
|
{
|
||||||
|
@ -376,6 +371,38 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
velocity = new Vector2(10, 10) * direction;
|
velocity = new Vector2(10, 10) * direction;
|
||||||
maindirection = velocity;
|
maindirection = velocity;
|
||||||
|
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Client)
|
||||||
|
{
|
||||||
|
NetworkTask task = new NetworkTask(typeof(Bullet), Pos, id, velocity);
|
||||||
|
AppManager.Instance.NetworkTasks.Add(task);
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ShootRight()
|
||||||
|
{
|
||||||
|
direction = new Vector2(1, 0);
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
|
velocity = new Vector2(10, 10) * direction;
|
||||||
|
maindirection = velocity;
|
||||||
|
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Client)
|
||||||
|
{
|
||||||
|
NetworkTask task = new NetworkTask(typeof(Bullet), Pos, id, velocity);
|
||||||
|
AppManager.Instance.NetworkTasks.Add(task);
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void ShootLeft()
|
||||||
|
{
|
||||||
|
direction = new Vector2(-1, 0);
|
||||||
|
acceleration = Vector2.Zero;
|
||||||
|
velocity = new Vector2(10, 10) * direction;
|
||||||
|
maindirection = velocity;
|
||||||
|
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Client)
|
||||||
|
{
|
||||||
|
NetworkTask task = new NetworkTask(typeof(Bullet), Pos, id, velocity);
|
||||||
|
AppManager.Instance.NetworkTasks.Add(task);
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void ShootUpLeft()
|
public void ShootUpLeft()
|
||||||
{
|
{
|
||||||
|
@ -383,6 +410,12 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
acceleration = Vector2.Zero;
|
acceleration = Vector2.Zero;
|
||||||
velocity = new Vector2(10, 10) * direction;
|
velocity = new Vector2(10, 10) * direction;
|
||||||
maindirection = velocity;
|
maindirection = velocity;
|
||||||
|
if (AppManager.Instance.multiPlayerStatus == MultiPlayerStatus.Client)
|
||||||
|
{
|
||||||
|
NetworkTask task = new NetworkTask(typeof(Bullet), Pos, id, velocity);
|
||||||
|
AppManager.Instance.NetworkTasks.Add(task);
|
||||||
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public override void OnCollision(GameObject gameObject)
|
public override void OnCollision(GameObject gameObject)
|
||||||
{
|
{
|
||||||
|
@ -391,7 +424,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
if (gameObject is CoreEnemy)
|
if (gameObject is CoreEnemy)
|
||||||
{
|
{
|
||||||
CoreEnemy enemy = (CoreEnemy)gameObject;
|
CoreEnemy enemy = (CoreEnemy)gameObject;
|
||||||
enemy.TakeDamage();
|
enemy.TakeDamage(1);
|
||||||
AppManager.Instance.GameManager.Remove(this);
|
AppManager.Instance.GameManager.Remove(this);
|
||||||
}
|
}
|
||||||
base.OnCollision(gameObject);
|
base.OnCollision(gameObject);
|
||||||
|
|
|
@ -236,6 +236,12 @@ namespace DangerousD.GameCore
|
||||||
SoundManager.StartSound(networkTask.name, networkTask.position, GameManager.GetPlayer1.Pos);
|
SoundManager.StartSound(networkTask.name, networkTask.position, GameManager.GetPlayer1.Pos);
|
||||||
break;
|
break;
|
||||||
case NetworkTaskOperationEnum.CreateEntity:
|
case NetworkTaskOperationEnum.CreateEntity:
|
||||||
|
if (networkTask.type == typeof(Player.Bullet))
|
||||||
|
{
|
||||||
|
Player.Bullet bullet = new Player.Bullet(networkTask.position);
|
||||||
|
bullet.id = networkTask.objId;
|
||||||
|
bullet.velocity = networkTask.velocity;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NetworkTaskOperationEnum.SendPosition:
|
case NetworkTaskOperationEnum.SendPosition:
|
||||||
if (networkTask.objId != GameManager.GetPlayer1.id )
|
if (networkTask.objId != GameManager.GetPlayer1.id )
|
||||||
|
|
|
@ -38,11 +38,12 @@ namespace DangerousD.GameCore.Network
|
||||||
/// <param name="EntityType"></param>
|
/// <param name="EntityType"></param>
|
||||||
/// <param name="EntityPosition"></param>
|
/// <param name="EntityPosition"></param>
|
||||||
/// <param name="ParentId"></param>
|
/// <param name="ParentId"></param>
|
||||||
public NetworkTask(Type EntityType, Vector2 EntityPosition, int ParentId)
|
public NetworkTask(Type EntityType, Vector2 EntityPosition, int ParentId, Vector2 velocity)
|
||||||
{
|
{
|
||||||
operation = NetworkTaskOperationEnum.CreateEntity;
|
operation = NetworkTaskOperationEnum.CreateEntity;
|
||||||
type = EntityType;
|
type = EntityType;
|
||||||
position = EntityPosition;
|
position = EntityPosition;
|
||||||
|
this.velocity = velocity;
|
||||||
objId = ParentId;
|
objId = ParentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue