Ejemplo n.º 1
0
 // Update is called once per frame
 void FixedUpdate()
 {
     cameraPos = Camera.main.transform.position.y;
     if (cameraPos < 40)
     {
         if (!waitingSpawn)
         {
             if (itemSpawn.Count == 0)
             {
                 specialQueueIncrement %= 20;
                 if (specialQueueIncrement == 19)
                 {
                     QueueStairs();
                 }
                 else if (specialQueueIncrement == 10)
                 {
                     QueueDivider();
                 }
                 else
                 {
                     QueueRandom();
                     spawnDelay   -= 0.008f;
                     nextSpawnTime = spawnDelay;
                 }
                 specialQueueIncrement++;
             }
             else
             {
                 SpawnItem nextItem = itemSpawn.Dequeue();
                 Instantiate(nextItem.item, nextItem.position, Quaternion.identity, blockParent);
                 StartCoroutine(SpawnWait(nextItem.time));
             }
         }
     }
 }
        /// <summary>
        /// Handles operation SpawnItem: Creates a new Item and optionally subscribes an InterestArea to it.
        /// </summary>
        public OperationResponse OperationSpawnItem(PeerBase peer, OperationRequest request)
        {
            log.InfoFormat("Spawn item operation started for peer: {0}", this.Peer.ToString());
            var operation = new SpawnItem(peer.Protocol, request);

            if (!operation.IsValid)
            {
                log.InfoFormat("Spawn item operation invalid");
                return(new OperationResponse(request.OperationCode)
                {
                    ReturnCode = (int)ReturnCode.InvalidOperationParameter, DebugMessage = operation.GetErrorMessage()
                });
            }

            operation.OnStart();
            var item = new Item(operation.Position, operation.Rotation, operation.Properties, this, operation.ItemId, operation.ItemType, this.World);

            if (this.World.ItemCache.AddItem(item))
            {
                log.InfoFormat("adding item");
                this.AddItem(item);
                return(this.ItemOperationSpawn(item, operation));
            }
            log.InfoFormat("Spawn item operation for peer: {0}", this.Peer.ToString());
            item.Dispose();
            return(operation.GetOperationResponse((int)ReturnCode.ItemAlreadyExists, "ItemAlreadyExists"));
        }
Ejemplo n.º 3
0
 public L2DropItem(SpawnItem pck)
 {
     this.ObjectID = pck.ObjectID;
     this.ItemID = pck.ItemID;
     this.Count = pck.Count;
     this.X = pck.X;
     this.Y = pck.Y;
     this.Z = pck.Z;
 }
Ejemplo n.º 4
0
    void spawn(SpawnItem item)
    {
        GameObject obj = item.gameObject;

        obj.transform.localScale = new Vector3(item.scale, item.scale, item.scale);

        Vector3    pos = Random.onUnitSphere * ((planet.transform.localScale.x / 2) + item.zOffset);
        Quaternion rot = Quaternion.FromToRotation(Vector3.down, planet.transform.position - pos);

        Instantiate(obj, pos, rot);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Fisher–Yates Shuffle Alg. Perfectly Random shuffle, O(n)
    /// </summary>
    private void ShuffleBag(List <SpawnItem> bag)
    {
        for (int i = 0; i < bag.Count - 2; i++)
        {
            int j = random.Next(i, bag.Count);

            SpawnItem swap = bag[i];
            bag[i] = bag[j];
            bag[j] = swap;
        }
    }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     PlayerComponent = GameObject.FindWithTag("Player") ;
     //POBIERAMY OD RODZICA SKRYPT
     spawnItem = GetComponentInParent<SpawnItem>() ;
     //JESLI SZUKANIE SIE POWIODLO TO PRZYPISUJEMY COMPONENT DO OBIEKTU
     if( PlayerComponent != null )
     {
         Debug.Log( "PlayerComponent is empty ( FastShoot )" ) ;
     }
 }
Ejemplo n.º 7
0
        private void gvAttachmentTypes_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
        {
            if (_curItemButton == null || _pack == null || CurrentLevel == null || !e.Column.Name.StartsWith(AttachmentColNamePrefix))
            {
                return;
            }

            SpawnItem item           = _curItemButton.Item;
            string    attachmentType = (string)e.Row;
            int       index          = int.Parse(e.Column.Name.Replace(AttachmentColNamePrefix, String.Empty));

            SpawnItemAttachment[] attachments = item.Attachments.Where(att => att.Type == attachmentType).ToArray();
            SpawnItemAttachment   attach      = index < attachments.Length ? attachments[index] : null;

            if (e.IsGetData)
            {
                if (attach != null)
                {
                    e.Value = attachments[index].Name;
                }
                else
                {
                    e.Value = null;
                }
            }
            else if (e.IsSetData)
            {
                string attachmentName = (string)e.Value;
                if (attachmentName == null)
                {
                    if (attach != null)
                    {
                        item.Attachments.Remove(attach);
                    }
                }
                else
                {
                    if (attach != null)
                    {
                        attach.Name = attachmentName;
                    }
                    else
                    {
                        attach = new SpawnItemAttachment(attachmentType, attachmentName);
                        item.Attachments.Add(attach);
                    }
                }

                _curItemButton.Refresh();

                UpdatePrognosis();
                _curItemButton.Refresh();
            }
        }
Ejemplo n.º 8
0
    void Start()
    {
        spawnee = GetComponentInChildren <SpawnItem>();

        // dist.Add(0, "Yennefer");

        foreach (KeyValuePair <int, string> ie in dist)
        {
            Debug.Log(ie.Key);
            Debug.Log(ie.Value);
        }
    }
Ejemplo n.º 9
0
        private SpawnItemButton AddSpawnItemButton(Control pnlLine, SpawnItem item)
        {
            var btnItem = new SpawnItemButton(item,
                                              (fileName) => ilSpawnItemTypesLarge.Images[GetImageIndex(ilSpawnItemTypesLarge, fileName, false)],
                                              (fileName) => ilAttachmentNames.Images[GetImageIndex(ilAttachmentNames, fileName, false)]);

            btnItem.ContextMenu = cmButton;
            btnItem.MouseDown  += btnItem_MouseDown;

            pnlLine.Controls.Add(btnItem);
            pnlLine.Refresh();

            return(btnItem);
        }
Ejemplo n.º 10
0
 private void spawn(SpawnItem item)
 {
     if (item.Formation == null)
     {
         spawn(item.Prefab, Vector2.zero);
     }
     else
     {
         foreach (var position in item.Formation.Positions)
         {
             spawn(item.Prefab, position);
         }
     }
 }
Ejemplo n.º 11
0
    private SpawnItem RollForWeapon(Spawner MainSpawner, int HandID)
    {
        // Currently forces to spawn a weapon from the force orders in the main hand. Does not care whether the weapon makes sense on the character.
        if (HandID == 0 && MainSpawner.GetSpawnOrdersForce().Count > 0)
        {
            SpawnerOrder OrderForce = MainSpawner.GetSpawnOrdersForce()[0];

            SpawnItem ForcedItem = new SpawnItem
            {
                SpawnWeight = 1,
                SpawnWeapon = OrderForce.RollForWeapon()
            };

            MainSpawner.SpawnOrderForceFulfilled(OrderForce);

            return(ForcedItem);
        }

        SpawnItem[] AllowedWeaponList = Weapons(HandID);

        SpawnerOrder[] OrdersForbid = MainSpawner.GetSpawnOrderForbid();

        for (int i = 0; i < OrdersForbid.Length; i++)
        {
            AllowedWeaponList = OrdersForbid[i].RemoveWeaponsFromList(AllowedWeaponList);
        }

        int NumberOfWeapons = AllowedWeaponList.Length;
        int TotalWeight     = 0;

        for (int i = 0; i < AllowedWeaponList.Length; i++)
        {
            TotalWeight += AllowedWeaponList[i].SpawnWeight;
        }

        int RolledNumber  = Random.Range(0, TotalWeight);
        int WeightCounter = 0;

        for (int i = 0; i < AllowedWeaponList.Length; i++)
        {
            WeightCounter += AllowedWeaponList[i].SpawnWeight;

            if (RolledNumber < WeightCounter)
            {
                return(AllowedWeaponList[i]);
            }
        }

        return(new SpawnItem()); // Should not be reachable!
    }
        private OperationResponse ItemOperationSpawn(Item item, SpawnItem operation)
        {
            // this should always return Ok
            MethodReturnValue result = this.CheckAccess(item);

            if (result.IsOk)
            {
                item.Rotation = operation.Rotation;
                item.Spawn(operation.Position);
                ((World)this.World).Radar.AddItem(item, operation.Position);
            }

            operation.OnComplete();
            return(operation.GetOperationResponse(result));
        }
Ejemplo n.º 13
0
    private GameObject SpawnItem(SpawnItem item)
    {
        var spawnedItem = LeanPool.Spawn(item.prefabToSpawn, transform.position, transform.rotation, (item.spawnOnRoot)?null:transform);

        if (logToFilter)
        {
            ConsoleProDebug.LogToFilter($"{item.nameIdentifier} spawned by {name} at {spawnedItem.transform.position}", "Create");
        }
        item.itemCount--;
        _count++;
        if (useEvents)
        {
            OnSpawnedItem?.Invoke(item);
        }
        return(spawnedItem);
    }
Ejemplo n.º 14
0
 // Use this for initialization
 void Start()
 {
     GameObject PlayerComponent = GameObject.FindWithTag("Player") ;
     //POBIERAMY OD RODZICA SKRYPT
     spawnItem = GetComponentInParent<SpawnItem>() ;
     //JESLI SZUKANIE SIE POWIODLO TO PRZYPISUJEMY COMPONENT DO OBIEKTU
     if( PlayerComponent != null )
     {
         player = PlayerComponent.GetComponent<PlayerMove>() ;
     }
     //JESLI NIE ZNALEZLISMY LUB PRZYPISANIE SIE NIE POWIODLO WYSWIETLAMY TEKST
     if(player == null)
     {
         Debug.Log( " can't find Player PlayerMove " ) ;
     }
 }
Ejemplo n.º 15
0
    private void AddSpawnItemInToSpawnList(Vector3 spawnPos, List <SpawnItem> bag,
                                           List <SpawnItem> fullBag)
    {
        SpawnItem spawn = BagPop(bag, fullBag);

        // If there are too many entities, do not add more to spawn list.
        var spawnedEntities = worldRoot.GetTree().GetNodesInGroup(Constants.SPAWNED_GROUP);

        if (spawnedEntities.Count >= maxAliveEntities)
        {
            return;
        }

        spawn.Position = spawnPos;

        itemsToSpawn.Enqueue(spawn);
    }
Ejemplo n.º 16
0
	private GemCell ConvertToGemCell(SpawnItem spawn) 
	{
		int gem = GemConverter.GetGemInt(spawn.GemName);
		GemCell newGemCell = GemCellPool.Instance.GetOneGemCell(gem);
		newGemCell.InitGem();
		var thisGem = newGemCell.Gem;
		if (thisGem.AllowBG)
		{
			int bg = GemBGConverter.GetGemInt(spawn.BgName);
			newGemCell.InitBgGem(bg);
		}
		if (thisGem.AllowFG)
		{
			int fg = GemFGConverter.GetGemInt(spawn.FgName);
			newGemCell.InitFgGem(fg);
		}
		return newGemCell;
	}
Ejemplo n.º 17
0
    private GemCell ConvertToGemCell(SpawnItem spawn)
    {
        int     gem        = GemConverter.GetGemInt(spawn.GemName);
        GemCell newGemCell = GemCellPool.Instance.GetOneGemCell(gem);

        newGemCell.InitGem();
        var thisGem = newGemCell.Gem;

        if (thisGem.AllowBG)
        {
            int bg = GemBGConverter.GetGemInt(spawn.BgName);
            newGemCell.InitBgGem(bg);
        }
        if (thisGem.AllowFG)
        {
            int fg = GemFGConverter.GetGemInt(spawn.FgName);
            newGemCell.InitFgGem(fg);
        }
        return(newGemCell);
    }
Ejemplo n.º 18
0
        private OperationResponse ItemOperationSpawn(MmoItem item, SpawnItem operation, InterestArea interestArea, MmoActor actor)
        {
            // this should always return Ok
            //MethodReturnValue result = this.CheckAccess(item, actor);

            //if (result) {
            //    item.Rotation = operation.Rotation;
            //    item.Spawn(operation.Position);

            //    if (interestArea != null) {
            //        lock (interestArea.SyncRoot) {
            //            interestArea.SubscribeItem(item);
            //        }
            //    }
            //}

            //operation.OnComplete();
            //return operation.GetOperationResponse(result);
            return(operation.GetOperationResponse(MethodReturnValue.Ok));
        }
Ejemplo n.º 19
0
    /// <summary>
    /// Spawns randomly on a timer.
    /// </summary>
    /// <returns>IEnumerator.</returns>
    IEnumerator RandomSpawn()
    {
        for (; ;)
        {
            if (portalSpawnTime > 0f)
            {
                yield return(new WaitForSeconds(portalSpawnTime));
            }
            else
            {
                yield return(new WaitForSeconds(Random.Range(20, 80)));
            }


            GameObject port        = Instantiate(portalPrefab, point.position, portalPrefab.transform.rotation);
            SpawnItem  portalSpawn = port.GetComponentInChildren <SpawnItem>();

            portalSpawn.setUp();
        }
    }
Ejemplo n.º 20
0
    private void SpawnItemsInSpawnList()
    {
        if (queuedSpawn != null)
        {
            SpawnQueuedSpawn();
        }
        else if (itemsToSpawn.Count > 0)
        {
            SpawnItem spawn = itemsToSpawn.Dequeue();

            if (spawn == null)
            {
                return;
            }

            var enumeraable = spawn.Spawn();
            if (enumeraable != null)
            {
                queuedSpawn = enumeraable.GetEnumerator();
                SpawnQueuedSpawn();
            }
        }
    }
        /// <summary>
        /// Handles operation SpawnItem: Creates a new Item and optionally subscribes an InterestArea to it.
        /// </summary>
        public OperationResponse OperationSpawnItem(PeerBase peer, OperationRequest request)
        {
            var operation = new SpawnItem(peer.Protocol, request);

            if (!operation.IsValid)
            {
                return(new OperationResponse(request.OperationCode)
                {
                    ReturnCode = (int)ReturnCode.InvalidOperationParameter, DebugMessage = operation.GetErrorMessage()
                });
            }

            operation.OnStart();
            var item = new Item(operation.Position, operation.Rotation, operation.Properties, this, operation.ItemId, operation.ItemType, this.World);

            if (this.World.ItemCache.AddItem(item))
            {
                this.AddItem(item);
                return(this.ItemOperationSpawn(item, operation));
            }

            item.Dispose();
            return(operation.GetOperationResponse((int)ReturnCode.ItemAlreadyExists, "ItemAlreadyExists"));
        }
Ejemplo n.º 22
0
    IEnumerator preload()
    {
        yield return(null);

        for (int k = 0; k < settings.Length; k++)
        {
            SpawnPoolSettings setting = settings[k];
            for (int i = 0; i < setting.spawnItemList.Count; i++)
            {
                SpawnItem item = setting.spawnItemList[i];
                for (int j = 0; j < item.amount; j++)
                {
                    createGameObject(item.prefab);
                }
            }
        }
        yield return(null);

        if (splashScreenDone)
        {
            LoadNextScene();
        }
        loadingDone = true;
    }
Ejemplo n.º 23
0
        public SpawnItemButton(SpawnItem item, Func <string, Image> getTypeImageByFileName, Func <string, Image> getAttachImageByFileName)
            : base()
        {
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }

            if (getTypeImageByFileName == null)
            {
                throw new ArgumentNullException("getTypeImageByFileName");
            }

            if (getAttachImageByFileName == null)
            {
                throw new ArgumentNullException("getAttachImageByFileName");
            }

            _getTypeImageByFileName   = getTypeImageByFileName;
            _getAttachImageByFileName = getAttachImageByFileName;
            Item      = item;
            FlatStyle = FlatStyle.Flat;
            Size      = new Size(PackForm.PixelInSec, 75);
        }
Ejemplo n.º 24
0
    /// <summary>
    /// "Pops" 0th item out of shuffled bag.
    /// If bag is empty, shuffle bag.
    /// </summary>
    /// <param name="bag">Bag to pop from</param>
    /// <param name="fullBag">Full bag needed to fill other bag if it runs out</param>
    /// <returns>Next Spawn Item</returns>
    private SpawnItem BagPop(List <SpawnItem> bag, List <SpawnItem> fullBag)
    {
        if (bag.Count == 0)
        {
            FillBag(bag, fullBag);
        }

        SpawnItem pop = bag[0];

        bag.RemoveAt(0);

        switch (pop)
        {
        case ChunkItem chunkPop:
            chunkPop.WorldNode = worldRoot;
            break;

        case MicrobeItem microbePop:
            microbePop.WorldNode = worldRoot;
            break;
        }

        return(pop);
    }
Ejemplo n.º 25
0
 public int FindWeight(SpawnItem s)
 {
     return(s.weight);
 }
Ejemplo n.º 26
0
 void Start()
 {
     objBroken.SetActive(true);
     objFixed.SetActive(false);
     spawner = FindObjectOfType <SpawnItem>();
 }
Ejemplo n.º 27
0
    void SimulateAR()
    {
        if (Input.GetMouseButton(0))
        {
            bool       touchedObject = false;
            Ray        ray           = CameraSingleton.Instance.GetActiveCamera().ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                TouchObject o = hit.collider.gameObject.GetComponent <TouchObject>();
                if (o)
                {
                    o.OnTouch();
                    touchedObject = true;
                }
            }

            if (!touchedObject)
            {
                RaycastHit tHit;
                Vector3    rotatedForward = Quaternion.Euler(Random.Range(-6f, 6f), Random.Range(-6f, 6f), 0f) * ray.direction;
                Ray        rotatedRay     = new Ray(ray.origin, rotatedForward);
                bool       cancelOut      = false;
                // Randomly select an item to spawn from the list
                SpawnItem item = WeightedSelection.RandomItem <SpawnItem>(spawnPrefabs, FindWeight);
                if (Physics.Raycast(rotatedRay, out tHit))
                {
                    for (int i = 0; i < spawnedObjects.Count; i++)
                    {
                        if (spawnedObjects[i] != null)
                        {
                            float d       = Vector3.Distance(tHit.point, spawnedObjects[i].obj.transform.position);
                            float padding = item.positionPadding + spawnedObjects[i].positionPadding;
                            if (d < padding)
                            {
                                cancelOut = true;
                                break;
                            }
                        }
                        else
                        {
                            randomGrassLocation.text = "Found a null grass object! Removing";
                            spawnedObjects.Remove(spawnedObjects[i]);
                        }
                    }

#if TESTING
                    if (Time.timeSinceLevelLoad > lastSample + 1f)
                    {
                        hitPointText.text      = "Hit point: " + tHit.Point.ToString();
                        closestGrassText.text  = "No longer calculating";
                        grassObjectsCount.text = "Grass count: " + spawnedObjects.Count.ToString();
                        if (spawnedObjects.Count > 0)
                        {
                            randomGrassLocation.text = spawnedObjects[Random.Range(0, spawnedObjects.Count)].transform.position.ToString();
                        }
                        lastSample = Time.timeSinceLevelLoad;
                    }
#endif

                    if (cancelOut)
                    {
                        return;
                    }

                    GameObject  newObj  = item.DoSetup(tHit.point, GameObject.Find("TestingArea").transform);
                    SpawnedItem newItem = new SpawnedItem();
                    newItem.obj = newObj; newItem.positionPadding = item.positionPadding;
                    spawnedObjects.Add(newItem);

                    newObj.transform.rotation = Quaternion.Euler(0.0f,
                                                                 Random.Range(-360f, 360f), 0f);
                }
            }
        }
    }
Ejemplo n.º 28
0
    void Update()
    {
#if UNITY_EDITOR
        SimulateAR();
        return;
#endif

        _QuitOnConnectionErrors();

        // The tracking state must be FrameTrackingState.Tracking in order to access the Frame.
        if (Frame.TrackingState != FrameTrackingState.Tracking)
        {
            const int LOST_TRACKING_SLEEP_TIMEOUT = 15;
            Screen.sleepTimeout = LOST_TRACKING_SLEEP_TIMEOUT;
            return;
        }

        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Frame.GetNewPlanes(ref m_newPlanes);

        // Iterate over planes found in this frame and instantiate corresponding GameObjects to visualize them.
        for (int i = 0; i < m_newPlanes.Count; i++)
        {
            // Instantiate a plane visualization prefab and set it to track the new plane. The transform is set to
            // the origin with an identity rotation since the mesh for our prefab is updated in Unity World
            // coordinates.
            GameObject planeObject = Instantiate(m_trackedPlanePrefab, Vector3.zero, Quaternion.identity,
                                                 transform);
            planeObject.GetComponent <TrackedPlaneVisualizer>().SetTrackedPlane(m_newPlanes[i]);
            planeObject.GetComponent <Renderer>().material.SetFloat("_UvRotation", Random.Range(0.0f, 360.0f));
        }

        // Disable the snackbar UI when no planes are valid.
        bool showSearchingUI = true;
        Frame.GetAllPlanes(ref m_allPlanes);
        for (int i = 0; i < m_allPlanes.Count; i++)
        {
            if (m_allPlanes[i].IsValid)
            {
                showSearchingUI = false;
                break;
            }
        }

        m_searchingForPlaneUI.SetActive(showSearchingUI);

        if (Input.touches.Length > 0)
        {
            TouchPhase t = Input.touches[0].phase; //just look at first touch until we decide how to handle multitouch

            if (t == TouchPhase.Ended)
            {
                tapMode = false;
            }

            Ray        ray = CameraSingleton.Instance.GetActiveCamera().ScreenPointToRay(Input.GetTouch(0).position);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                if (t == TouchPhase.Began)
                {
                    TouchObject o = hit.collider.gameObject.GetComponent <TouchObject>();
                    if (o)
                    {
                        o.OnTouch();
                        tapMode = true;
                    }
                }
            }

            if (!tapMode && t != TouchPhase.Ended)
            {
                TrackableHit     tHit;
                TrackableHitFlag raycastFilter  = TrackableHitFlag.PlaneWithinBounds | TrackableHitFlag.PlaneWithinPolygon;
                Vector3          rotatedForward = Quaternion.Euler(Random.Range(-6f, 6f), Random.Range(-6f, 6f), 0f) * ray.direction;
                Ray  rotatedRay = new Ray(ray.origin, rotatedForward);
                bool cancelOut  = false;
                // Randomly select an item to spawn from the list
                SpawnItem item = WeightedSelection.RandomItem <SpawnItem>(spawnPrefabs, FindWeight);
                if (Session.Raycast(rotatedRay, raycastFilter, out tHit))
                {
                    for (int i = 0; i < spawnedObjects.Count; i++)
                    {
                        if (spawnedObjects[i] != null)
                        {
                            float d       = Vector3.Distance(tHit.Point, spawnedObjects[i].obj.transform.position);
                            float padding = item.positionPadding + spawnedObjects[i].positionPadding;
                            if (d < padding)
                            {
                                cancelOut = true;
                                break;
                            }
                        }
                        else
                        {
                            randomGrassLocation.text = "Found a null grass object! Removing";
                            spawnedObjects.Remove(spawnedObjects[i]);
                        }
                    }

#if TESTING
                    if (Time.timeSinceLevelLoad > lastSample + 1f)
                    {
                        hitPointText.text      = "Hit point: " + tHit.Point.ToString();
                        closestGrassText.text  = "No longer calculating";
                        grassObjectsCount.text = "Grass count: " + spawnedObjects.Count.ToString();
                        if (spawnedObjects.Count > 0)
                        {
                            randomGrassLocation.text = spawnedObjects[Random.Range(0, spawnedObjects.Count)].transform.position.ToString();
                        }
                        lastSample = Time.timeSinceLevelLoad;
                    }
#endif

                    if (cancelOut)
                    {
                        return;
                    }

                    // Create an anchor to allow ARCore to track the hitpoint as understanding of the physical
                    // world evolves.
                    var anchor = Session.CreateAnchor(tHit.Point, Quaternion.identity);

                    GameObject  newObj  = item.DoSetup(tHit.Point, anchor.transform);
                    SpawnedItem newItem = new SpawnedItem();
                    newItem.obj = newObj; newItem.positionPadding = item.positionPadding;
                    spawnedObjects.Add(newItem);

                    newObj.transform.rotation = Quaternion.Euler(0.0f,
                                                                 Random.Range(-360f, 360f), 0f);

                    // Use a plane attachment component to maintain y-offset from the plane (occurs after anchor updates).
                    newObj.GetComponent <PlaneAttachment>().Attach(tHit.Plane);
                }
            }
        }
    }
Ejemplo n.º 29
0
 /// <summary>
 /// Adds item to spawnItems, which is used for spawning Spawn Events
 /// </summary>
 public void AddSpawnItem(SpawnItem spawnItem)
 {
     spawnItems.Add(spawnItem);
 }
Ejemplo n.º 30
0
 void Awake()
 {
     worktop = GetComponent <Worktop>();
     squashedGrapeSpawner = GetComponent <SpawnItem>();
 }
Ejemplo n.º 31
0
        private void AddSpawnItem(Control pnlLine, SpawnItemButton btnInsertAfter, bool isBindCurrent, SpawnItem newItem = null)
        {
            var line            = GetLine(pnlLine);
            var insertAfterItem = btnInsertAfter == null ? null : btnInsertAfter.Item;

            if (newItem == null)
            {
                newItem = line.InsertItem(Pack.SpawnItemConfig.Types.Keys.First(), insertAfterItem);
            }
            else
            {
                line.InsertItem(newItem, insertAfterItem);
            }

            var newBtn = AddSpawnItemButton(pnlLine, newItem);

            if (isBindCurrent)
            {
                BindSpawnItem(newBtn);
            }

            IsNeedSave = true;

            UpdatePrognosis();
        }
Ejemplo n.º 32
0
 internal void Add(SpawnItem item)
 {
     enemiesToSpawn.Add(item);
 }
Ejemplo n.º 33
0
 private void Start()
 {
     spawnItem = GameObject.FindObjectOfType <SpawnItem>();
 }
Ejemplo n.º 34
0
 void Start()
 {
     bottleSpawner = GetComponent <SpawnItem>();
     worktop       = GetComponent <Worktop>();
     worktop.onPlaceItem.AddListener((item) => TakeItem(item));
 }