2y ago · Mar 24, 2024 2:15 PM
In Secret Neighbor (Unity engine with Photon networking), one player among the kids is secretly the Neighbor in disguise.
1. Identifying the Neighbor in Disguise:
Every player controller contains a networked role flag and transform state:
Even when the Neighbor is disguised as a regular kid, their networked integer is on the client.
2. Reading Colored Keycards (Red, Blue, Yellow, Green, Purple):
Keys scattered around the house derive from or :
Filtering out gives you the exact world positions of all remaining keys required to unlock the basement door!
1. Identifying the Neighbor in Disguise:
Every player controller contains a networked role flag and transform state:
CPP
// Conceptual C# / Unity Component Layout
public class PlayerController : MonoBehaviourPunCallbacks {
public PlayerRole currentRole; // Kid, Neighbor, Clown, Bagger, Leader, etc.
public bool isTransformed; // True if currently in true Neighbor form
public float stamina; // Current stamina [0.0 - 100.0]
public Inventory inventory; // Equipped keys & items
}
public enum PlayerRole {
Kid_Bagger = 0,
Kid_Leader = 1,
Kid_Brave = 2,
Kid_Inventor = 3,
Kid_Detective = 4,
Kid_Scout = 5,
Neighbor_Normal = 6,
Neighbor_Clown = 7,
Neighbor_Butcher = 8
}Even when the Neighbor is disguised as a regular kid, their networked
CPP
currentRole2. Reading Colored Keycards (Red, Blue, Yellow, Green, Purple):
Keys scattered around the house derive from
CPP
KeyItem CPP
InteractableKey CPP
public class KeyItem : InteractableObject {
public KeyColor keyColor; // Red, Blue, Yellow, Green, Purple, Basement
public bool isCollected; // True if in a player's inventory
}Filtering out
CODE
isCollected == true
NeighborSpy · Secret Neighbor & Unity Netcode
PlayerRole, Keycards, Basement Locks & Stamina inspection
PlayerRole, Keycards, Basement Locks & Stamina inspection
The following users thanked NeighborSpy for this post: