Example #1
0
    private void SetDestroyLocal(GameObject objToDestroy, TypeOfHashSet hsType)
    {
        if (objToDestroy)
        {
            if (hsType == TypeOfHashSet.bases)
            {
                DelBaseFromHashSet(objToDestroy);
            }
            else if (hsType == TypeOfHashSet.portables)
            {
                DelPortableFromHashSet(objToDestroy);
            }
            else if (hsType == TypeOfHashSet.other)
            {
                DelOtherObjFromHashSet(objToDestroy);
            }

            DelMoveableFromDict(objToDestroy);

            Rigidbody rbToDel = objToDestroy.GetComponent <Rigidbody>();
            affectedBodies.Remove(rbToDel);
            GameStats.freeRunPts++;
            Destroy(objToDestroy);
        }
    }
Example #2
0
 /// <summary>
 /// уничтожает объект и контролирует его нахождение в хеш-сете
 /// </summary>
 /// <param name="objToDestroy"></param>
 /// <param name="timerToDestroy"></param>
 /// <param name="hsType"></param>
 public void SetDestroyObj(GameObject objToDestroy, TypeOfHashSet hsType, float timerToDestroy = 0)
 {
     if (timerToDestroy > 0)
     {
         StartCoroutine(SetDestroyCorut(objToDestroy, timerToDestroy, hsType));
     }
     else
     {
         SetDestroyLocal(objToDestroy, hsType);
     }
 }
Example #3
0
    private IEnumerator SetDestroyCorut(GameObject objToDestroy, float timerToDestroy, TypeOfHashSet hsType)
    {
        yield return(new WaitForSeconds(timerToDestroy));

        SetDestroyLocal(objToDestroy, hsType);
    }