示例#1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        CustomImageEffect effect = FindObjectOfType <CustomImageEffect>();

        if (effect == null)
        {
            return;
        }

        mat = effect.EffectMaterial;
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        _timer       = 0;
        _soberPeriod = 5f;

        _health    = 20;
        _healthMax = 20;
        _powerups  = FindObjectOfType <PowerUps>();
        //haetaan camerasta scripti ja sorkitaan materiaalin propertya. Materiaalin property ei resettaa muuten nollaan pelin alkaessa velii
        _drunk       = 0;
        drunkHandler = GameObject.Find("Main Camera").GetComponent <CustomImageEffect>();
        drunkHandler.EffectMaterial.SetFloat("_Magnitude", 0);
    }
    public override void OnInspectorGUI()
    {
        //DrawDefaultInspector();

        CustomImageEffect s = (CustomImageEffect)target;

        s.ExposeProperties();
        foreach (ShaderProperty p in s.properties)
        {
            if (p.name != "_MainTex")
            {
                p.Draw();
                p.Update();
            }
        }
    }
示例#4
0
    void Start()
    {
        c      = GetComponent <Collider2D> ();
        cam    = GameObject.Find("Main Camera").GetComponent <CustomImageEffect> ();
        source = new Vector2(transform.position.x, transform.position.y);
        bool pointLeft = gameObject.transform.position.x > 0;

        leftOrRight = pointLeft ? Vector2.left : Vector2.right;
        //laserSound = GameObject.Find ("LaserHolder").GetComponent<AudioSource> ();
        laserBoxSound  = GameObject.Find("LaserBoxHolder").GetComponent <AudioSource> ();
        laserKillSound = GameObject.Find("LaserKillHolder").GetComponent <AudioSource> ();

        //laserSound.clip.LoadAudioData ();
        laserBoxSound.clip.LoadAudioData();
        laserKillSound.clip.LoadAudioData();
        laserBoxSound.loop = true;
//		laserSound.loop = true;
//		laserSound.Play ();
    }