public static Bullet Spawn(Vector3 position, Vector2 direction, float timer, float speed) { tmpBullet = null; for (int i = 0; i < pool.Count; i++) { if (!pool[i].isActiveAndEnabled) { tmpBullet = pool[i]; tmpBullet.gameObject.SetActive(true); break; } } if (tmpBullet == null) { tmpBullet = Instantiate(PrefabManager.Current.BulletPrefab); pool.Add(tmpBullet); } tmpBullet.transform.position = position; tmpBullet.Timer = timer; WrappingWorld.Register(tmpBullet); tmpBullet._rb.velocity = direction * speed; tmpBullet.hit = false; return(tmpBullet); }
public static FuelTree Spawn(string id, Vector3 position, int fuels) { tmpTree = null; for (int i = 0; i < pool.Count; i++) { if (!pool[i].isActiveAndEnabled) { tmpTree = pool[i]; tmpTree.gameObject.SetActive(true); break; } } if (tmpTree == null) { tmpTree = Instantiate(PrefabManager.Current.FuelTreePrefab); pool.Add(tmpTree); } tmpTree.transform.position = position; tmpTree.LoadedObjectDefinition = id; tmpTree.Fuels = fuels; WrappingWorld.Register(tmpTree); return(tmpTree); }
public static void SwitchToWorld(WorldGenerator.WorldDefinition world) { PlayerCharacter.Current.gameObject.SetActive(true); for (int i = 0; i < WorldCameras.Count; i++) { WorldCameras[i].SetActive(true); } for (int i = 0; i < SpaceCameras.Count; i++) { SpaceCameras[i].SetActive(false); } CurrentState = GameMode.PlanetPlaying; WrappingWorld.ResetWorld(); PlayerCharacter.Current.ResetWorld(); WrappingWorld.Current.LoadWorld(world); }
public static void Despawn(Bullet bullet) { bullet.gameObject.SetActive(false); WrappingWorld.Deregister(bullet); }
public void Awake() { Current = this; }