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 Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -10,6 +12,7 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
|||
{
|
||||
public class SilasBall : LivingEntity
|
||||
{
|
||||
private bool IsVisibility=true;
|
||||
public SilasBall(Vector2 position) : base(position)
|
||||
{
|
||||
Height = 60;
|
||||
|
@ -30,6 +33,17 @@ namespace DangerousD.GameCore.GameObjects.Entities
|
|||
public override void Update(GameTime 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)
|
||||
{
|
||||
GraphicsComponent.CameraPosition = (_pos-new Vector2(200, 350)).ToPoint();
|
||||
GraphicsComponent.SetCameraPosition(Pos);
|
||||
if (!isAttacked)
|
||||
{
|
||||
Move(gameTime);
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace DangerousD.GameCore.Graphics
|
|||
private List<Texture2D> textures;
|
||||
private List<string> texturesNames;
|
||||
private AnimationContainer currentAnimation;
|
||||
static private int scaling=3;
|
||||
public AnimationContainer CurrentAnimation
|
||||
{
|
||||
get
|
||||
|
@ -167,6 +168,8 @@ namespace DangerousD.GameCore.Graphics
|
|||
|
||||
destinationRectangle.X -= CameraPosition.X;
|
||||
destinationRectangle.Y -= CameraPosition.Y;
|
||||
|
||||
destinationRectangle = Scaling(destinationRectangle);
|
||||
_spriteBatch.Draw(texture,
|
||||
destinationRectangle, sourceRectangle, Color.White);
|
||||
}
|
||||
|
@ -191,10 +194,18 @@ namespace DangerousD.GameCore.Graphics
|
|||
destinationRectangle.X -= CameraPosition.X;
|
||||
destinationRectangle.Y -= CameraPosition.Y;
|
||||
|
||||
destinationRectangle = Scaling(destinationRectangle);
|
||||
_spriteBatch.Draw(texture,
|
||||
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()
|
||||
{
|
||||
sourceRectangle = new Rectangle();
|
||||
|
@ -222,6 +233,12 @@ namespace DangerousD.GameCore.Graphics
|
|||
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