I am developing a small game prototype in Unity 3.5.5f - in which the player controls a small mind controlling alien. The player needs to be able to take control of a target human NPC, switching all camera and controls to the human in question.
N.B. All of my code, thus far, is in C#.
I have two ideas on how to progress, which one is more feasible? (I'm happy to listen to alternative ideas)
The pros and cons as far as I seem them:
EDIT: A friend has pointed out, yes the NPCs have scripts of their own which would need to be disabled.
This is pretty simple, in concept.
Just have the NPC similar to the player class, in that it accepts control whenever something is true.
For example:
class NPC {
static bool isBeingControlled = false;
public void OnUpdate() {
if (isBeingControlled)
{
//set camera position to NPC position (make sure you're using NPC as an instantiated class)
//accept key input WASD or whatever you are using and move NPC according to input.
}
}
}
You'll have to instantiate NPC for each NPC you have in your game.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With