feat: add creatures and drops on the map

This commit is contained in:
k0t9i
2023-02-07 22:21:15 +04:00
parent d03f37fbf7
commit 2480563914
13 changed files with 529 additions and 59 deletions

View File

@@ -1,4 +1,5 @@
using Client.Domain.Common;
using System;
namespace Client.Domain.ValueObjects
{
@@ -9,10 +10,40 @@ namespace Client.Domain.ValueObjects
private Vector3 velocity;
private Vector3 acceleration;
public Vector3 Position { get => position; set { if (value != position) { position = value; OnPropertyChanged("Position"); } } }
public Vector3 Rotation { get => rotation; set { if (value != rotation) { rotation = value; OnPropertyChanged("Rotation"); } } }
public Vector3 Velocity { get => velocity; set { if (value != velocity) { velocity = value; OnPropertyChanged("Velocity"); } } }
public Vector3 Acceleration { get => acceleration; set { if (value != acceleration) { acceleration = value; OnPropertyChanged("Acceleration"); } } }
public Vector3 Position { get => position; set { if (value != position) { position = value; OnPropertyChanged(); } } }
public Vector3 Rotation {
get => rotation;
set
{
if (value != rotation)
{
rotation = value;
OnPropertyChanged();
OnPropertyChanged("Direction");
}
}
}
private void Rotation_PropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "Y")
{
OnPropertyChanged("Direction");
}
}
public Vector3 Velocity { get => velocity; set { if (value != velocity) { velocity = value; OnPropertyChanged(); } } }
public Vector3 Acceleration { get => acceleration; set { if (value != acceleration) { acceleration = value; OnPropertyChanged(); } } }
public Vector3 Direction
{
get
{
float deg = Rotation.Y / 65535 * 2 * MathF.PI;
return new Vector3(MathF.Cos(deg), MathF.Sin(deg), 0);
}
}
public Transform(Vector3 position, Vector3 rotation, Vector3 velocity, Vector3 acceleration)
{
@@ -20,6 +51,7 @@ namespace Client.Domain.ValueObjects
this.rotation = rotation;
this.velocity = velocity;
this.acceleration = acceleration;
rotation.PropertyChanged += Rotation_PropertyChanged;
}
}
}