- Home /
Methods Repeats for each New Player connected
Hi! I'm working on multiplayer rpg game and i have a functions: Aggro, Attack... For example function Attack is called when T pressed and then damage is being given. Method finished. Then, when we create a new player and having entered the world, this function is called for a new player again. And i dont need to do. And when monster made Aggro() on the player was standing near this monster,a new clients will see how this monster made Aggro on this player again and the texture that show AggroTexture will appear again, but i need this new player see the result when aggro is finished. So there are methods which repeat for new players even if they finished long ago.
Example of Attack() Function:
void Attack()
{
if (_target != null && IfTargetAlive())
{
if (_targetSelected && _target != null && networkView.isMine && IfTargetAlive() && _target.tag == "Creature" ||
(this.tag != _target.tag && _target.tag.Contains("Player")))
{
if (Vector3.Distance(_target.transform.position, this.transform.position) <= 1.6f &&
Mathf.Abs(Vector3.Angle(transform.forward, this.transform.position - _target.transform.position)) < 270)
{
attackable = true;
if (canAttack)
{
if (Input.GetKey(KeyCode.T))
{
animMainFlag = true;
}
if (animMainFlag)
{
if (!animChoosen)
{
curAnimNum = (int)Random.Range(0, 3);
animChoosen = true;
}
if (animChoosen)
{
networkView.RPC("AnimNetwork", RPCMode.AllBuffered, animationAttackList.ElementAt(curAnimNum));
}
}
}
else
{
attackable = false;
}
}
}
}
}
I hope u can help me... Thank in advance
Your answer
Follow this Question
Related Questions
Create and Keep Track of Player LIst in Server... 0 Answers
Networking RPC calls never sent to other clients 1 Answer
Spawning Clients 1 Answer
Player falls through plane/floor (Multiplayer) 1 Answer
raycast hit to player in network ,how?? 0 Answers