Example #1
0
    // Use this for initialization

    public override void OnHit(Collider other)
    {
        GuiLayer.AddMoney(100);
        PlayClipSound();
        //audio.Play();
        MakeInactive();
    }
Example #2
0
    private void MakeMagnit()
    {
        //этап 1
        if (effectMade == 1)
        {
            float raznx, raznz, razny, vspz;
            float smex = 0.125f;
            raznx = -parentTransform.position.x + walkingBearTransform.position.x;
            razny = -parentTransform.position.y + walkingBearTransform.position.y + 1;
            raznz = -parentTransform.position.z + walkingBearTransform.position.z;

            if (Mathf.Abs(raznx) > smex)
            {
                raznx = Mathf.Sign(raznx) * smex;
            }
            if (Mathf.Abs(razny) > smex)
            {
                razny = Mathf.Sign(razny) * smex;
            }

            if (raznz > smex)
            {
                vspz = playerScript.GetRealVelocity();
            }
            else
            {
                vspz = 0;
            }

            if (Mathf.Abs(raznz) > smex)
            {
                raznz = Mathf.Sign(raznz) * smex;
            }

            raznz += vspz;

            parentTransform.position += new Vector3(raznx, razny, raznz);
        }

        if (effectMade == 2)
        {
            float smex = 0.1f;

            camx += smex;
            camy += smex * 2.3f;

            parentTransform.position = new Vector3(cameraTransform.position.x + camx, cameraTransform.position.y + camy, walkingBearTransform.position.z + 5);

            if (parentTransform.position.y > cameraTransform.position.y + 0.5)
            {
                GuiLayer.AddMoney(numberOfMoney);
                flagRotation = false;
                effectMade   = 3;
            }
        }
    }