示例#1
0
        //-------------------------------------------------------------------------
        // Auto Node API
        //-------------------------------------------------------------------------
        public override void Handle(GraphEngine graphEngine)
        {
            if (Spawner != null)
            {
                if (Dynamic)
                {
                    NodePort inPort  = GetInputPort(nameof(DynamicAmount));
                    NodePort outPort = inPort.Connection;
                    if (outPort.node is AutoValueNode n)
                    {
                        Debug.Log(n.Value.GetType());
                        Spawner.SetSpawnAmount((float)n.Value);
                    }
                    else
                    {
                        Debug.LogWarning("Please connect a int or float Value Node to the Amount port.");
                    }
                }
                else
                {
                    Spawner.SetSpawnAmount(Amount);
                }

                Spawner.SpawnCurrency();
            }
            else
            {
                Debug.LogWarning("Please add a spawner to your " + nameof(SpawnCurrencyNode) + ".");
            }
        }
        //-------------------------------------------------------------------------
        // Collectible API
        //-------------------------------------------------------------------------
        /// <summary>
        /// The particle explodes into several pieces which then begin gravitating towards the
        /// onscreen wallet.
        /// </summary>
        public override void OnCollected()
        {
            base.OnCollected();
            if (PickupSounds != null)
            {
                int   soundNum = Random.Range(0, PickupSounds.Count);
                Sound s        = PickupSounds[soundNum];
                AudioManager.Play(s.Name);
            }

            spawner.SpawnCurrency();

            StartCoroutine(DestroyAfterFinished());
        }