Merge branch 'TimofeyPlan'
This commit is contained in:
commit
5013d77972
3 changed files with 35 additions and 4 deletions
|
@ -1,7 +1,9 @@
|
||||||
using DangerousD.GameCore.Graphics;
|
using DangerousD.GameCore.Graphics;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -10,6 +12,7 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
{
|
{
|
||||||
public class SilasBall : LivingEntity
|
public class SilasBall : LivingEntity
|
||||||
{
|
{
|
||||||
|
private bool IsVisibility=true;
|
||||||
public SilasBall(Vector2 position) : base(position)
|
public SilasBall(Vector2 position) : base(position)
|
||||||
{
|
{
|
||||||
Height = 60;
|
Height = 60;
|
||||||
|
@ -30,7 +33,18 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
base.Update(gameTime);
|
base.Update(gameTime);
|
||||||
|
if (AppManager.Instance.GameManager.physicsManager.CheckRectangle(Rectangle).Count>0)
|
||||||
|
{
|
||||||
|
IsVisibility = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public override void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
if (IsVisibility)
|
||||||
|
{
|
||||||
|
base.Draw(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint();
|
GraphicsComponent.SetCameraPosition(Pos);
|
||||||
if (!isAttacked)
|
if (!isAttacked)
|
||||||
{
|
{
|
||||||
Move(gameTime);
|
Move(gameTime);
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace DangerousD.GameCore.Graphics
|
||||||
private List<Texture2D> textures;
|
private List<Texture2D> textures;
|
||||||
private List<string> texturesNames;
|
private List<string> texturesNames;
|
||||||
private AnimationContainer currentAnimation;
|
private AnimationContainer currentAnimation;
|
||||||
|
static private int scaling=3;
|
||||||
public AnimationContainer CurrentAnimation
|
public AnimationContainer CurrentAnimation
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -167,6 +168,8 @@ namespace DangerousD.GameCore.Graphics
|
||||||
|
|
||||||
destinationRectangle.X -= CameraPosition.X;
|
destinationRectangle.X -= CameraPosition.X;
|
||||||
destinationRectangle.Y -= CameraPosition.Y;
|
destinationRectangle.Y -= CameraPosition.Y;
|
||||||
|
|
||||||
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture,
|
_spriteBatch.Draw(texture,
|
||||||
destinationRectangle, sourceRectangle, Color.White);
|
destinationRectangle, sourceRectangle, Color.White);
|
||||||
}
|
}
|
||||||
|
@ -191,10 +194,18 @@ namespace DangerousD.GameCore.Graphics
|
||||||
destinationRectangle.X -= CameraPosition.X;
|
destinationRectangle.X -= CameraPosition.X;
|
||||||
destinationRectangle.Y -= CameraPosition.Y;
|
destinationRectangle.Y -= CameraPosition.Y;
|
||||||
|
|
||||||
|
destinationRectangle = Scaling(destinationRectangle);
|
||||||
_spriteBatch.Draw(texture,
|
_spriteBatch.Draw(texture,
|
||||||
destinationRectangle, sourceRectangle, Color.White);
|
destinationRectangle, sourceRectangle, Color.White);
|
||||||
}
|
}
|
||||||
|
private Rectangle Scaling(Rectangle destinationRectangle)
|
||||||
|
{
|
||||||
|
destinationRectangle.X *= scaling;
|
||||||
|
destinationRectangle.Y *= scaling;
|
||||||
|
destinationRectangle.Width *= scaling;
|
||||||
|
destinationRectangle.Height *= scaling;
|
||||||
|
return destinationRectangle;
|
||||||
|
}
|
||||||
private void buildSourceRectangle()
|
private void buildSourceRectangle()
|
||||||
{
|
{
|
||||||
sourceRectangle = new Rectangle();
|
sourceRectangle = new Rectangle();
|
||||||
|
@ -222,6 +233,12 @@ namespace DangerousD.GameCore.Graphics
|
||||||
interval = lastInterval;
|
interval = lastInterval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static Point CameraPosition = new Point(0, 0);
|
public static void SetCameraPosition(Vector2 playerPosition)
|
||||||
|
{
|
||||||
|
CameraPosition=(playerPosition).ToPoint();
|
||||||
|
CameraPosition.X -= 300;
|
||||||
|
CameraPosition.Y -= 200;
|
||||||
|
}
|
||||||
|
public static Point CameraPosition = new Point(-700, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue