Esempio n. 1
0
    void Start()
    {
        int  maxBuoys         = 5;      //max limit available
        bool tooCloseToOthers = SoundBuoyScript.CloseToOthers(gameObject, 100.0f);

        if (!tooCloseToOthers)
        {
            tooCloseToOthers = BlackHoleScript.CloseToOthers(gameObject, 100.0f);
        }

        if (WorldBuoysList.Count >= maxBuoys || tooCloseToOthers)
        {
            DestroyImmediate(gameObject);
            return;
        }


        buoyAnimations[0] = "appear";
        buoyAnimations[1] = "moving";
        buoyAnimations[2] = "drop";
        buoyAnimations[3] = "ringing";
        buoyAnimations[4] = "ding";
        buoyAnimations[5] = "sink";
        buoyAnimations[6] = "underwater";

        sprite.animationCompleteDelegate += AnimationComplete;

        WorldBuoysList.Add(this);
        fluidField = GameObject.FindGameObjectWithTag("fluidField").GetComponent <FluidFieldGenerator>();

        audio.clip   = ringingSounds[WorldBuoysList.IndexOf(this)];
        audio.loop   = true;
        audio.volume = 0.0f;
        audio.Play();
    }
Esempio n. 2
0
    void Start()
    {
        int  maxBlackHoles    = 4;
        bool tooCloseToOthers = SoundBuoyScript.CloseToOthers(gameObject, 100.0f);

        if (!tooCloseToOthers)
        {
            tooCloseToOthers = BlackHoleScript.CloseToOthers(gameObject, 100.0f);
        }

        if (WorldBlackHoles.Count >= maxBlackHoles || tooCloseToOthers)
        {
            DestroyImmediate(gameObject);
            return;
        }

        WorldBlackHoles.Add(this);
    }