Пример #1
0
 public void OnDestroy()
 {
     if (I == this)
     {
         I = null;
     }
 }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
    //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();
        }
    }
Пример #5
0
 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;
 }
Пример #6
0
 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);
     }
 }
Пример #7
0
        /// <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}.");
            }
        }
Пример #8
0
 public void Awake()
 {
     I = this;
 }
Пример #9
0
 public void OnDestroy()
 {
     I = null;
 }
 public void Awake()
 {
     Instance = this;
 }
 public void OnDestroy()
 {
     Instance = null;
 }
Пример #12
0
 public Line(Spawnables l, Spawnables c, Spawnables r) //Constructor
 {
     left   = l;
     center = c;
     right  = r;
 }
Пример #13
0
 private void Awake()
 {
     _ins = this;
 }