Exemple #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.name.Contains("Player"))
     {
         bl_ObstacleRoot t = GetComponentInParent <bl_ObstacleRoot>();
         t.DoExplosion(other.transform);
         bl_GameManager.Instance.GameOver();
     }
 }
Exemple #2
0
    void Start()
    {
        m_Root = GetComponentInParent <bl_ObstacleRoot>();

        if (bl_GameManager.Instance.m_GameMode == GameMode.PickUp)
        {
            int maxTrys = 12;
            CalculatePosition();
            bool found = true;

            while (Physics.CheckBox(InstancePosition, new Vector3(2, 2, 2)))
            {
                CalculatePosition();
                maxTrys--;
                if (maxTrys <= 0)
                {
                    found = false;
                    break;
                }
            }
            if (found)
            {
                if (bl_ObstaclesManager.Instance.UsePoolMethod)
                {
                    cacheObject = bl_ObstaclesManager.Instance.GetItem();
                    cacheObject.transform.position = InstancePosition;
                    cacheObject.transform.parent   = transform;
                    cacheObject.SetActive(true);
                }
                else
                {
                    GameObject obj = Instantiate(m_Root.ItemPrefab, InstancePosition, Quaternion.identity) as GameObject;
                    obj.transform.parent = transform;
                }
            }
        }
    }