i am trying to create a football simulation program. i have a main class named "team" and 4 derived classes named "goalKeeper", "defender", "forward" and "midfielder".
i am creating players according to their position.
ex:
team fb = new team("fb");
forward alex = new forward(fb.tName, "alex", 73, 77, 77, 69, 70);
my team class:
public class team
{
public string tName;
public team(string tName)
{
this.tName = tName;
}
public string teamInfo()
{
return tName;
}
}
forward class:
class forward:team
{
//özellikler
public string pName;
public string pPosName;
public int finishing;
public int longShots;
public int composure;
public int offTheBall;
public int firstTouch;
public forward(string tName, string pName, int finishing, int longShots, int composure, int offTheBall, int firstTouch)
: base(tName)
{
this.pName = pName;
this.pPosName = "Forward";
this.finishing = finishing;
this.longShots = longShots;
this.composure = composure;
this.offTheBall = offTheBall;
this.firstTouch = firstTouch;
}
//etkiyi hesapla
public double influence
{
get
{
//calculations
return processed;
}
}
//futbolcunun genel bilgileri
public void playerInfo()
{
Console.WriteLine( "\n##############################\n" + pName + "-" + tName + "-" + pPosName + "\n" + "Finishing= " + finishing + "\n" + "Long Shots= " + longShots + "\n" + "Composure= " + composure + "\n" + "Off the ball= " + offTheBall + "\n" + "Frist Touch= " + firstTouch + "\n##############################\n");
}
}
as you can see i am calculating influence of each player according to their technical attributes.
what i want is automating the process. for example i've created a team.. added players, and i want all player's influence to be called via team name. i am going to give team name and position name and it is gonna give me average influence of players in that team's chosen position.
how can i do this?
thanks in advance...
note: my code might look stupid. i am a newbie :)
A forward IS A team?
Not at all... A team HAS A forward...
Dont use inheritance... use composition instead.
A player is not a team, this would give you an idea
public class Team
{
private IList<Player> _players
...
}
public class Player
{
public string Name {get;set;}
public abstract Influence { get; }
}
public class Forward : Player
{
public override Influence
{
get { return //calculation }
}
}
I would suggest rethinking your inheritence strategy.
When a class inherits another this implies that the child class 'is a' base class. Applying this to your model implies that a forward 'is a' team which doesn't make much sense. In reality a team 'has a' forward(s).
A more accurate model for what you are trying to achieve is to have a player class as your base class that your foward class, defender class etc inherits from. Your team class can then contains a collection of player classes.
Related
The code given below is a simple solution to a problem, i have to do another one using polymorphism, but i am kinda new in this C# thing (almost know nothing), but i need some ideas how to recreate this code, and the code to be able to take strings from input as desired words to be switched with the default ones. Hope someone will help me, because i have absolutely no idea how to do this (i made this code by some miracle, but this task is on another level for me right now).
Thanks for everybody that will help.
Console.WriteLine("BEFORE: " + value);
string modified = value.Replace("cow", "duck").Replace("moo", "quack");
string modified1 = value.Replace("cow", "cat").Replace("moo", "meow");
string modified2 = value.Replace("cow", "dog").Replace("moo", "aw");
string modified3 = value.Replace("cow", "goat").Replace("moo", "mee");
string modified4 = value.Replace("cow", "sheep").Replace("moo", "bee");
Console.WriteLine("AFTER: " + modified);
Console.WriteLine("AFTER: " + modified1);
Console.WriteLine("AFTER: " + modified2);
Console.WriteLine("AFTER: " + modified3);
Console.WriteLine("AFTER: " + modified4);
}
}
In yours sample only animals where used, therefore class Animal is provided.
Also, given context for text is something resembling speech, therefore Talk method.
Matching yours sample all animals from array replace 'speech' of a cow with own.
public class Animal {
protected string Kind, Says;
protected Animal(string kind, string says) { Kind = kind; Says = says;
}
public string Talk(Animal impersonate, string stream) {
return stream.Replace(impersonate.Kind, Kind).Replace(impersonate.Says, Says);
}
}
public class Cow : Animal { public Cow() : base("cow", "moo") { } }
public class Duck : Animal { public Duck() : base("duck", "quack") { } }
public class Cat : Animal { public Cat() : base("cat", "meow") { } }
public class Dog : Animal { public Dog() : base("dog", "aw") { } }
public class Goat : Animal { public Goat() : base("goat", "mee") { } }
public class Sheep : Animal { public Sheep() : base("sheep", "bee") { } }
class Program {
static void Sample2(string value) {
var cow = new Cow();
foreach (var animal in new Animal[] {
new Duck(),
new Cat(),
new Dog(),
new Goat(),
new Sheep()
})
Console.WriteLine("AFTER: " + animal.Talk(cow, value));
}
static void Main(string[] args) {
var value = "cow does something like moo";
Console.WriteLine("BEFORE: " + value);
Sample1(value);
Sample2(value);
Console.ReadLine();
}
static void Sample1(string value) {
string modified = value.Replace("cow", "duck").Replace("moo", "quack");
string modified1 = value.Replace("cow", "cat").Replace("moo", "meow");
string modified2 = value.Replace("cow", "dog").Replace("moo", "aw");
string modified3 = value.Replace("cow", "goat").Replace("moo", "mee");
string modified4 = value.Replace("cow", "sheep").Replace("moo", "bee");
Console.WriteLine("AFTER: " + modified);
Console.WriteLine("AFTER: " + modified1);
Console.WriteLine("AFTER: " + modified2);
Console.WriteLine("AFTER: " + modified3);
Console.WriteLine("AFTER: " + modified4);
}
}
As shown above, this sample will match provided input. Class and Method names can be renamed to be more generic.
Consider the following;
public override string ToString()
{
return $"{HouseName}{StreetLine1 + " : "}{StreetLine2}{PostalTown + " : "}:{PostCode + " : "}{Country}";
}
This is nothing more than a simple override of ToString() to give end users in an application a little more meaningful information about an address entity than they would otherwise get were no override provided.
HouseName, StreetLine2 and Country are all allowed null values on the backend database. I am wondering if rather than writing separate methods to determine the value of these and then return either nothing or the value + " : " there is a way to do this via a Lambda or func within the actual string interpolation statement itself.
I am still learning my way around C# and what searching I have done to date seems to indicate that this probably isn't possible even with the magical Elvis operator. However it's equally possible that I've simply misunderstood what I have been reading.
EDIT
Following #Evk's answer I created the following quick console app.
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var adr = new Address { StreetLine1 = "1 Any Road", PostalTown = "Any Town", PostCode = "AB12 3CD" };
Console.WriteLine($"{(adr.HouseName != null ? " : " + adr.HouseName : "")} : {adr.StreetLine1 } : { (adr.StreetLine2 != null ? " : " + adr.StreetLine2 : "")} : {adr.PostalTown} : {adr.PostCode} ");
Console.ReadLine();
}
}
public class Address
{
public string HouseName { get; set; }
public string StreetLine1 { get; set; }
public string StreetLine2 { get; set; }
public string PostalTown { get; set; }
public string PostCode { get; set; }
public string Country { get; set; }
}
}
This produced the following result
: 1 Any Road : : Any Town : AB12 3CD
In reality I was after
1 Any Road : Any Town : AB12 3CD
and as you can see I have not even factored in Country , which had it been set should have produced;
1 Any Road : Any Town : AB12 3CD : Any Country
if rather than writing separate methods to determine the value of
these and then return either nothing or the value + " : " there is a
way to do this within the actual string interpolation statement itself
You can use "?:" operator, just enclose it in "()":
$"{StreetLine1 + (StreetLine2 != null ? " : " + StreetLine2 : "")}";
However if you just need to join bunch of strings together - use String.Join:
String.Join(" : ", new[] {HouseName, StreetLine1, StreetLine2}.Where(c => c != null));
I'm making a game that involves with the players choice of gender and want to reflect the dialogue of the player's choice with the correct pronouns. I was thinking of using boolean but was advice not to as it seems kind of bad making one of the genders to be true and the other to be false. So trying to use enums on this but my only problem is how to implement it correctly and have it working. Haven't really used enums that much before to be use for strings.
This is what I have so far:
public class UITextBoxScript : MonoBehaviour
{
public Text mytext;
enum Gender
{
None, Male, Female
}
enum States
{
Instructions, Warning, YourGender, Test
}
Gender playerGender = Gender.None;
Gender playersGender = Gender.Male;
Gender playGender = Gender.Female;
int gender = 0; // using 0 or 1 (or 0, 1, 2.. if you might ever have 'unset')
string[] heshe = { "he", "she" };
string[] hisher = { "his", "her" };
string[] himher = { "him", "her" };
Then this is the target area of where it should hit and affect the user's choice:
void state_YourGender()
{
mytext.text = "Okay!" +
"\n" +
"\n" +
"What is your love interest gender?" +
"\n" +
"\n" +
"\n" +
"\n" +
"A) Male" +
"\n" +
"\n" +
"S) Female";
timer -= Time.deltaTime;
if (Input.GetKeyDown(KeyCode.A))
{
myState = States.Test;
gender = 0;
Gender playersGender = Gender.Male;
}
else if (Input.GetKeyDown(KeyCode.S))
{
myState = States.Test;
}
}
void state_Test()
{
string phrase=" _heshe_was really happy";
string newPhrase = phrase.Replace("_HESHE_", heshe[gender]);
timer -= Time.deltaTime;
if (timer <= 0 && Input.GetKeyDown(KeyCode.Space))
{
timer = timerVal;
myState = States.YourGender;
}
}
I have been trying to experiment and find a way to call out the string to return to me but the string itself is not returning at all. I'm also using mytextbox and the area of a small box for the dialogue to show up and it has been working fine; no issues there. Any advice or tips?
Using enums to store exclusive values like gender is a good idea, but there are a few design decisions in your code that are not good ideas. First, you already have four global variables just to store one player's gender roles. That's already too many, and will get worse with every player or NPC you add. Instead, create a class for storing people:
public class Person
{
public string Name { get; private set; }
public Gender Gender { get; private set; }
public Gender LoveInterestGender { get; private set; }
public Person(string name, Gender gender, Gender loveInterestGender)
{
if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException(nameof(name));
Name = name;
Gender = gender;
LoveInterestGender = loveInterestGender;
}
}
Beginners are strangely reluctant to create new classes. Don't be; that is the main way you will simplify your code. Now you can create your player through code or a UI:
var player = new Person(name: "Hiro Protagonist", gender: Gender.Male, loveInterestGender: Gender.Female);
It's also a bad idea to try to customize dialog using string replacement; often you want to change the actual dialog, not just replace every “he” with “she” or such. You need to specify rules for dialogs to follow. For example, we could specify a different rule for each dialog depending on the gender of the speaker and listener. How do you do that? With another class, of course. Though, for reasons I won't go into, in this particular case a readonly struct would be better:
public struct DialogSpecifier : IEquatable<DialogSpecifier>
{
public readonly Gender SpeakerGender;
public readonly Gender ListenerGender;
public DialogSpecifier(Gender speakerGender, Gender listenerGender)
{
SpeakerGender = speakerGender;
ListenerGender = listenerGender;
}
public bool Equals(DialogSpecifier other)
{
return SpeakerGender==other.SpeakerGender
&& ListenerGender==other.ListenerGender;
}
}
Okay, so now we have people, and rules for dialogs. How do we make people speak to each other using these rules? We could write a bunch of code for each person for each rule for each gender. Wow, that's a lot of code! How do we simplify code again? Oh yeah, create a class:
public class Dialogue
{
Dictionary<DialogSpecifier, string> specifiedDialog = new Dictionary<DialogSpecifier, string>();
public Dialogue(string noneToNone)
{
specifiedDialog.Add(new DialogSpecifier(Gender.None, Gender.None), noneToNone);
}
public Dialogue Add(DialogSpecifier specifier, string dialogue)
{
specifiedDialog.Add(specifier, dialogue);
return this;
}
public string OpeningGambit(Person speaker, Person listener)
{
string gambit;
if (specifiedDialog.TryGetValue(new DialogSpecifier(speakerGender: speaker.Gender, listenerGender: listener.Gender),
out gambit))
return gambit;
return specifiedDialog[new DialogSpecifier(Gender.None, Gender.None)];
}
}
Okay, so now let's create some people and dialogues:
var introduction = new Dialogue("Hello")
.Add(new DialogSpecifier(Gender.Male, Gender.Male), "Wassup?");
var npc = new Person(name: "Juanita Marquez", gender: Gender.Female, loveInterestGender: Gender.Male);
var gambit = introduction.OpeningGambit(player, npc);
Simple, right? That's because we created classes and didn't try to write code for every possible permutation. This is easily extensible, too; we can Add gambits for different situations, or change specifiedDialog to a Dictionary<DialogSpecifier, List<string>> so we can have a list of gambits instead of a single one for each specifier. We could add more rules to DialogSpecifier, for example to behave differently if the listener is the speaker's LoveInterestGender. Doing that only requires changing one class; you don't have to rewrite all your code every time you add something.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I'm still a new coder, learning how I can. Must confess I tried many approaches, but still not moving forward. This code could be a bit complicated, so tried to show you how it's constructed.
I want to access the dictionary I made for a state in my State Machine state, which is an instance of a class.
I designed it so I have a state in class (player can switch states), and every state holds state name, description, bool whether there are enemies, dictionary of enemies (number and a list of races), and bool whether there are non-player characters.
Added some more code so you can have an idea of how it all runs / is structured.
Machine was working great before adding monsters, now after I press play I get the error: "NullReferenceException: Object reference not set to an instance of an object
StateController.GetTransitionsAndActions () (at Assets/_Scripts/GameRPG/StateMachines/StateController.cs:169)
StateController.Start () (at Assets/_Scripts/GameRPG/StateMachines/StateController.cs:131)"
...whis is pointing to that line in State Controller: Monobehaviour script:
Debug.Log ("monster.name: " + monster.name);
Keep in mind I only show you parts of my scripts, but should be enough to make it debug output in Unity console.
public class FunMachine : IStateMachine
{
List<FunMachineState> mStates;
FunMachineState mCurrent;
FunMachineState mExit;
List <Monster> monsterList = new List<Monster> ();
public FunMachine()
{
List <Monster> monsterList = new List<Monster> ();
MonsterManualVol1 monsterManualVol1 = new MonsterManualVol1 (monsterList);
FunMachineState entryHall = new FunMachineState("Grand Entrance", "You are standing in a grand enterance of a castle.\nThere are tables and chairs, but nothing you can interact with.", "Enter the Grand Entrance", true, new Dictionary<int, Monster> (){{7, monsterList.Find(x => x.name.Contains("orc"))}}, false);
// (...) many other similar states here
}
// Hook up doors.
entryHall.Neighbors.Add(staircase);
entryHall.Neighbors.Add(mExit);
// Add them to the collection
mStates = new List<FunMachineState>();
mStates.Add(entryHall);
// Finally set my starting point
mCurrent = entryHall;
#region IStateMachine Overrides
public override IState CurrentState
{
get { return mCurrent; }
}
public override List<FunMachineState> PossibleTransitions()
{
List<FunMachineState> transitionResult = mCurrent.Neighbors;
return transitionResult = mCurrent.Neighbors;
}
public override Dictionary<int, Monster> GetStateMonsters ()
{
Dictionary<int, Monster> result = new Dictionary<int, Monster> ();
List <Monster> monsterList = new List<Monster> ();
MonsterManualVol1 monsterManualVol1 = new MonsterManualVol1 (monsterList);
result = mCurrent.Monsters;
return result;
}
// (...) more code
}
FunMachineState:
public class FunMachineState : IState
{
string mName;
string mDescription;
string mPlayerChoiceButtonText;
bool mEnemies;
bool mNpcs;
Dictionary<int, Monster> mEnemyDictionary;
List<FunMachineState> mNeighbors = new List<FunMachineState>();
public List<FunMachineState> Neighbors { get { return mNeighbors; } }
public Dictionary <int, Monster> Monsters { get { return mEnemyDictionary; } }
public FunMachineState(string mName, string mDescription, string mPlayerChoiceButtonText, bool mEnemies, Dictionary<int, Monster> mEnemyDictionary, bool mNpcs)
{
this.mName = mName;
this.mDescription = mDescription;
this.mPlayerChoiceButtonText = mPlayerChoiceButtonText;
this.mEnemies = mEnemies;
this.mEnemyDictionary = mEnemyDictionary;
this.mNpcs = mNpcs;
}
#region IState Overrides
public override string GetName()
{
Debug.Log ("Here mName runs!");
return mName;
}
public override string GetStateDescriptionText()
{
return mDescription;
}
public override Dictionary<int, Monster> GetStateMonsters()
{
return Monsters;
}
// (...) more code
}
IStateMachine:
public abstract class IStateMachine
{
// List of all possible transitions we can make from this current state.
public abstract List<FunMachineState> PossibleTransitions();
// Get those monsters.
public abstract Dictionary<int, Monster> GetStateMonsters ();
// (...) more code
}
IState:
public abstract class IState
{
public abstract Dictionary<int, Monster> GetStateMonsters ();
// Do something
public abstract void Run();
// (...) more code
}
Now run it:
public class StateController : MonoBehaviour
{
public StateController stateController;
IStateMachine machine = GetMachine();
private static IStateMachine GetMachine()
{
IStateMachine machine = null;
machine = new FunMachine();
return machine;
}
void Start()
{
if (!machine.IsComplete())
{
Debug.Log("Currently in " + machine.CurrentState);
machine.CurrentState.Run();
Text_main_game_content.text = machine.CurrentState.GetStateDescriptionText();
GetTransitionsAndActions ();
}
public void GetTransitionsAndActions(){
Dictionary<int, Monster> monsterlisting = machine.CurrentState.GetStateMonsters();
if (monsterlisting.Values.Count > 0)
foreach (var monster in monsterlisting.Values) {
Debug.Log ("monster.name: " + monster.name);
}
}
}
// (...) more code
}
And my monster collection:
public class Monster
{
public string name, description;
public bool hostile;
public int hitPoints;
public int damage;
public int loot;
public string coin_type;
public Monster (string c_name, string c_description, bool c_hostile, int c_hitPoints, int c_damage, int c_loot, string c_coin_type)
{
name = c_name;
description = c_description;
hostile = c_hostile;
loot = c_loot;
hitPoints = c_hitPoints;
coin_type = c_coin_type;
damage = c_damage;
}
}
public class MonsterManualVol1
{
public MonsterManualVol1 (List <Monster> c_monsterList)
{
List <Monster> monsterList = new List<Monster> ();
monsterList = c_monsterList;
monsterList.Add (goblin);
monsterList.Add (orc);
}
Monster goblin = new Monster("Goblin", "Cute goblin", true, 7, 5, 28, "sz");
Monster orc = new Monster("Orc", "Pretty orc", true, 6, 6, 20, "sz");
}
I really don't know what's going on. Tried to convert that dictionary to list, didn't work too.
Oh, and this debugs properly at the start of state machine. Addition to public class FunMachine: IStateMachine:
public class FunMachine : IStateMachine
{
public override List<Monster> MonsterListDebug () {
monsterList = new List<Monster> ();
MonsterManualVol1 monsterManualVol1 = new MonsterManualVol1 (monsterList);
Debug.Log ("monsterList.Count: " + monsterList.Count);
for (int i = 0; i < monsterList.Count; i++)
{
Debug.Log ("Monster name: " + monsterList [i].name +
" Monster description: " + monsterList [i].description +
" Monster hostility: " + monsterList [i].hostile +
" Monster hit points: " + monsterList [i].hitPoints +
" Monster hit damage: " + monsterList [i].damage +
" Monster hit loot: " + monsterList [i].loot + " " + monsterList [i].coin_type);
}
return monsterList;
}
public FunMachine()
{
// (...)
//MonsterListDebug (monsterList);
MonsterListDebug ();
// (...)
}
// (...)
}
I just can't get it to debug from actual CurrentState in StateController, which runs the game properly. Debug only works from FunMachine class, like shown above. Foreach loop in StateController drops null reference, that's the only problem. Monodevelop shows no errors.
It's difficult to follow the exact flow, but my guess is that the problem lies in this part:
List <Monster> monsterList = new List<Monster> ();
public FunMachine()
{
List <Monster> monsterList = new List<Monster> ();
FunMachineState entryHall = new FunMachineState("...", "...", "...", true,
new Dictionary<int, Monster> (){{7, monsterList.Find(x => x.name.Contains("orc"))}}, false);
//...
}
Specifically, you are declaring a class variable called monsterList and another local variable with the same name inside your constructor - at that stage both lists will be empty, so when you call monsterList.Find(x => x.name.Contains("orc")) you get back NULL; your dictionary then has an item with key = 7 and value = null
You later try to loop through the dictionary entries and print the monster name and get a NullReferenceException
Edit
Ok guys... I have that problem solved. ... I looked for "orc", while it's just "Orc"... That's all.
Uh, not quite. You found one way to induce the bug. You have not solved the problem.
The solution is not:
Just type a correctly cased string
Implement a case insensitive name search
I should be able to search for "Yabadabadoo" and not get a NullReferenceException.
KMussa's answer gets to it. That Dictionary<int, Monster> should handle null values. The fix is in 2 parts:
Part 1
Don't instantiate both class-level and local variables.
I think what you meant to do in the method is: monsterlist.Clear()
Part 2
Don't allow null dictionary values
or, implement the null object pattern for the Monster class
or, guard for null when iterating the dictionary
or, implement an iterator for the "monster collection" that will not pass null values to the iterating client code.
The best way to do part 2 is to write a custom "MonsterCollection" or "MonsterDictionary" class. Then the easiest fix would be an Add() method that rejects null stuff.
If both parts are not done, the problem is not fixed.
end Edit
Easier, cleaner debugging.
Move this ...
"Monster name: " + monsterList [i].name +
" Monster description: " + monsterList [i].description +
" Monster hostility: " + monsterList [i].hostile +
" Monster hit points: " + monsterList [i].hitDice +
" Monster hit damage: " + monsterList [i].damage +
" Monster hit loot: " + monsterList [i].loot + " " + monsterList
... to Monster and override ToString. then:
for (int i = 0; i < monsterList.Count; i++)
{
Debug.Log (monsterList[i].ToString());
}
return monsterList;
... and even better, also override ToString in MonsterManualVol1 then the for loop goes away and you're left with:
Debug.Log(monsterList.ToString());
Write a ToString for StateController. Of course this will also include calling ToString for it's properties.
In fact, write ToString for all your classes and really clean up logging code.
Don't need to both initialize and set a property in the constructor:
public class FunMachine : IStateMachine
{
List <Monster> monsterList = new List<Monster> ();
public FunMachine()
{
List <Monster> monsterList = new List<Monster> ();
}
Test string parameters for null:
public Monster (string c_name, ...)
{
name = c_name; // could be null
// so:
name = c_name ?? string.Empty;
In Visual Studio, do you have Debug | Exceptions... set?
I'll explain but codes can explain it way better than me.
I'm trying to get value of 2 variables
I create a new object at it's class and use its members which I set their values from packet.
Whenever I try to access them I find them zeros which kind of doesn't make sense to me.
Here is the important part of the code that is related to the problem
public class PacketHandler
{
.
. dots means unrelated long code
.
public PacketHandler()
{
}
public ushort actualX { get; set; }
public ushort actualY { get; set; }
.
.
.
case 10010:
{
if (BitConverter.ToUInt16(data, 8) == 1002)
{
actualX = BitConverter.ToUInt16(data, 24);
actualY = BitConverter.ToUInt16(data, 26);
}
break;
and here is the other class I'm trying to get the value at
public class ClientBase
{
GameUser role2;
PacketHandler ph = new PacketHandler(); <<<<<<<<
public ClientBase(GameUser role)
{
role2 = role;
Thread T = new Thread(HuntThread) { Name = "Hunt Thread" };
T.Start(this);
Console.WriteLine("with name : " +T.Name + " with execution context : "+T.ExecutionContext +" with state : "+ T.IsAlive + " with id : " + T.ManagedThreadId);
T.Join();
}
Monster GetNextkill()
{
Monster CurrentTarget = null;
foreach (KeyValuePair<uint, Monster> Pair in Dictionary.Clone(Dictionary.Monsters))
{
CurrentTarget = Pair.Value;
}
return CurrentTarget;
}
public void HuntThread(object Sender)
{
try
{
ClientBase Client = Sender as ClientBase;
while (true)
{
Monster Target = GetNextkill();
if (Target != null)
{
Thread.Sleep(1000);
ProxyParadise.Network.Packets.PacketStructure ps = new ProxyParadise.Network.Packets.PacketStructure();
ps.__Packet10010(Target.X, Target.Y, role2, "normal", "server", ph.actualX, ph.actualY); <<<<< i get zeros at the ph.actualX/Y
Thread.Sleep(1000);
ps.__Packet10010(Target.X, Target.Y, role2, "sdasdsa", "client", role2.X, role2.Y);
Thread.Sleep(1000);
ps.__Packet1022NONEXP(Target.UID, Target.X , Target.Y, role2);
Dictionary.Monsters.SafeRemove(Target.UID);
please forgive me if I sound stupid, and to make it more clear ,I want a proper way of transferring data through classes at a new thread.
Please try to apply it to this example for better understanding.
have a wonderful day