예제 #1
0
 void OnTriggerEnter(Collider coll)
 {
     if (coll.CompareTag("Player"))
     {
         AudioManager.s_instance.PlayPop();
         ResourceManager.ChangeResource(m_type, 1);
         Destroy(this.gameObject);
     }
 }
예제 #2
0
        protected override void CompleteAction()
        {
            if (player.currentTool == gatherTool)
            {
                drops.spawnFromMaterial(transform.position);
                player.RemoveResourceFromWatch(this);
                if (m_breakSound)
                {
                    m_breakSound.Play();
                    GameObject.Destroy(m_currentModel);
                    GameObject.Destroy(m_gatherUIWrapper);
                    GameObject.Destroy(m_repairUIWrapper);
                    GameObject.Destroy(m_runningUIWrapper);
                    deleteFlag = true;
                    GameObject.Destroy(this.gameObject, m_breakSound.clip.length);
                }
                else
                {
                    GameObject.Destroy(this.gameObject);
                }
            }
            else if (player.currentTool == repairTool)
            {
                var  costProfile  = ResourceManager.GetCostProfile(m_type);
                bool foundLimiter = false;
                foreach (var costItem in costProfile.m_buildingCost)
                {
                    if (costItem.m_viabilityBool == false)
                    {
                        foundLimiter = true;
                    }
                }

                if (!foundLimiter)
                {
                    foreach (var costItem in costProfile.m_buildingCost)
                    {
                        Debug.Log("Cost Item: ID-" + costItem.m_type + " Delta-" + costItem.m_delta);
                        ResourceManager.ChangeResource(costItem.m_type, costItem.m_delta);
                    }
                    Repair();
                }
                else
                {
                    currentHit = maxHit; UpdateUI();
                }
            }
        }