/// <summary> /// Create a ghost platoon without a corresponding real platoon, to be used /// for buy previews. /// </summary> public static GhostPlatoonBehaviour CreatePreviewMode( Unit unit, PlayerData owner, int unitCount) { GhostPlatoonBehaviour ghost = Instantiate( Resources.Load <GameObject>( "GhostPlatoon")).GetComponent <GhostPlatoonBehaviour>(); ghost.Initialize(unit, owner); while (unitCount > 0) { ghost.AddSingleUnit(); unitCount--; } return(ghost); }
public void RpcEstablishReferences( uint ghostPlatoonNetId, uint[] unitNetIds) { NetworkIdentity identity; if (NetworkIdentity.spawned.TryGetValue(ghostPlatoonNetId, out identity)) { GhostPlatoon = identity.gameObject.GetComponent <GhostPlatoonBehaviour>(); } // Also find, augment and link to the units: foreach (uint unitNetId in unitNetIds) { if (NetworkIdentity.spawned.TryGetValue(unitNetId, out identity)) { UnitDispatcher unit = identity.GetComponent <UnitDispatcher>(); AddSingleExistingUnit(unit); } } }