示例#1
0
        private void OnDeath()
        {
            //Trigger it only when a random number is below the amount of chances of instanciation
            //
            //For example, when chances are 30%, we need the number to be bellow or equal to 30
            //    0       30                        100
            //    /===================================/
            //        ^                 ^
            //        |                 |
            //      Here            Not here

            if (RandomExtensions.GetRandomInt(0, 100) <= chancesOfInstanciation)
            {
                Instantiate(prefab, topParentTranform.position, Quaternion.Euler(Vector3.zero));
            }
        }