- Home /
Implement a module that plays against the player
Hi guys
Last year, I createad a tactical RPG. There are two teams in the game and each player can control one of them. The game is finished, all mechanics are ready as the victory and the lose condition.
What I really want to do know is implementing a module that control the team with the orange characters and play against the player.
I wound't like to reprogram all the game, because there are lots of script in it. I just wanted to create a module that can use them.
Each caracter has a script called "Player" that sets which character has been select by the player. I use this function to do this:
if (Input.GetMouseButtonDown(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit) && hit.transform == this.transform && (isWhichPlayer == gameManager.playerTurn))
{
if(!isPlayer)
GetComponent<AudioSource>().PlayOneShot(clips[0]);
print(isWhichPlayer);
mapa.GetComponent<Movimentacao>().TurnEnd();
isPlayer = true;
mapa.GetComponent<Movimentacao>().TurnStart();
}
}
and I have another big script called "Movement" which is attached to the map of the game that contains all characters mechanics and the movement function.
How could I implement the module? Do I need to create everything again?
Your answer
![](https://koobas.hobune.stream/wayback/20220612225932im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Work on 1 project with 2 computers on local network at the same time? 3 Answers
Character movement problem 0 Answers
Unity With c# and Nuget in visual studio 0 Answers