public void OnDestroy() { if (I == this) { I = null; } }
public static void DisplayShot(Vector2 start, Vector2 end) { if (effect == null) { effect = Spawnables.Get <HitscanEffect>("HitscanEffect"); } var spawned = PoolObject.Spawn(effect); spawned.Set(start, end); }
private static Projectile SpawnLocal(Vector2 position, Vector2 direction, float speed, int seed) { var spawned = PoolObject.Spawn(Spawnables.Get <Projectile>("Projectile")); spawned.transform.position = position; spawned.Direction = direction; spawned.Speed = speed; spawned.Seed = seed; return(spawned); }
//Get data and Spawn cubes void Start() { path = Application.streamingAssetsPath + "/Data.json"; jsonString = File.ReadAllText(path); spawnablesData = JsonUtility.FromJson <Spawnables>(jsonString); for (int i = 0; i < 10; i++) { SpawnCubes(); } }
private void Awake() { map = new SortedDictionary <string, Object>(); foreach (var item in Objects) { if (item != null) { string name = item.name.Trim().ToLowerInvariant(); map.Add(name, item); Debug.Log($"Registered '{name}' as {item.GetType().Name}."); } } Instance = this; }
void SpawnIn(Spawnables myObject, Transform myLocation) { if (myObject == Spawnables.Egg) { Instantiate(egg, myLocation); } else if (myObject == Spawnables.Gem) { Instantiate(gem, myLocation); } else if (myObject == Spawnables.Spike) { Instantiate(spike, myLocation); } }
/// <summary> /// Sets the mounted weapon to the mounted weapon with the specified prefab name. Only works when called from the server. /// If the weapon is null, the current weapon is removed instantly. /// </summary> /// <param name="spot">The spot. Should be on this vehicle, and not null!</param> /// <param name="mountedWeaponName">The name of the prefab.</param> public void SetWeapon(MountedWeaponSpot spot, string mountedWeaponName) { if (string.IsNullOrWhiteSpace(mountedWeaponName)) { Debug.LogError("Null or whitespace name. Cannot set mounted weapon!"); return; } var spawnable = Spawnables.Get <MountedWeapon>(mountedWeaponName); if (spawnable != null) { var spawned = Instantiate(spawnable); SetWeapon(spot, spawned); JNet.Spawn(spawned.gameObject); } else { Debug.LogError($"Failed to spawn mounted weapon from name {mountedWeaponName}."); } }
public void Awake() { I = this; }
public void OnDestroy() { I = null; }
public void Awake() { Instance = this; }
public void OnDestroy() { Instance = null; }
public Line(Spawnables l, Spawnables c, Spawnables r) //Constructor { left = l; center = c; right = r; }
private void Awake() { _ins = this; }