void ensureInstantiation() { if (instantiated) return; defaultMove = transform.parent.GetComponentInChildren<AbstractMovementAbility>(); defaultGeneric = transform.parent.GetComponentInChildren<AbstractGenericAbility>(); catMove = GameObject.Instantiate(PounceAbilityprefab).GetComponent<AbstractMovementAbility>(); catMove.transform.SetParent(transform.parent, false); catGeneric = GameObject.Instantiate(BatAbilityprefab).GetComponent<AbstractGenericAbility>(); catGeneric.transform.SetParent(transform.parent, false); instantiated = true; }
void ensureInstantiation() { if (instantiated) { return; } defaultMove = transform.parent.GetComponentInChildren <AbstractMovementAbility>(); defaultGeneric = transform.parent.GetComponentInChildren <AbstractGenericAbility>(); catMove = GameObject.Instantiate(PounceAbilityprefab).GetComponent <AbstractMovementAbility>(); catMove.transform.SetParent(transform.parent, false); catGeneric = GameObject.Instantiate(BatAbilityprefab).GetComponent <AbstractGenericAbility>(); catGeneric.transform.SetParent(transform.parent, false); instantiated = true; }
void Start() { moveAbility = GetComponentInChildren <AbstractMovementAbility>(); superAbility = GetComponentInChildren <SuperAbility>(); genAbility = GetComponentInChildren <AbstractGenericAbility>(); stats = GetComponent <Stats>(); node = NetworkNode.node; if (node is Client || node is Server) { if (players.Count == 0) { node.Subscribe(this); //only the first element should be subscribed to the node } players.Add(new NetworkPlayerIdentity(stats.playerID, stats.networkMode, this)); node.Subscribe <OutgoingNetworkStreamMessage>(this); } }