Esempio n. 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     SampleRotate.DoIt();
 }
Esempio n. 2
0
    void Start()
    {
        SetButtonActive(false);

        if (ObjectCountinputField)
        {
            ObjectCountinputField.onValueChanged.AddListener(s =>
            {
                int.TryParse(s, out Count);
            });
        }

        if (InstantiateButton)
        {
            InstantiateButton.onClick.AddListener(InstantiateObject);
        }

        if (ControllToggle)
        {
            ControllToggle.onValueChanged.AddListener(v => {
                Controll = v;
                SetButtonActive(v);

                if (controllAnimation)
                {
                    if (Controll)
                    {
                        if (samplePlay == null)
                        {
                            samplePlay = controllAnimation.gameObject.AddComponent <SamplePlay>();
                        }
                    }
                    else
                    {
                        if (samplePlay)
                        {
                            Destroy(samplePlay);
                            samplePlay = null;
                        }
                    }
                }
            });
        }
        if (ShowEffectToggle)
        {
            ShowEffectToggle.onValueChanged.AddListener(v => {
                ShowEffect = v;
                if (controllAnimation)
                {
                    SamplePlayEffect samplePlayEffect = controllAnimation.GetComponent <SamplePlayEffect>();
                    if (samplePlayEffect != null)
                    {
                        samplePlayEffect.enabled = ShowEffect;
                    }
                }
            });
        }
        if (RotateToggle)
        {
            RotateToggle.onValueChanged.AddListener(v => {
                Rotate = v;
                if (controllAnimation)
                {
                    SampleRotate sampleRotate = controllAnimation.GetComponent <SampleRotate>();
                    if (sampleRotate == null)
                    {
                        sampleRotate = controllAnimation.gameObject.AddComponent <SampleRotate>();
                    }
                    if (sampleRotate != null)
                    {
                        sampleRotate.enabled = Rotate;
                    }
                }
            });
        }
        if (IdleButton)
        {
            IdleButton.onClick.AddListener(() => {
                if (samplePlay)
                {
                    samplePlay.PlayIdle();
                }
            });
        }
        if (RunButton)
        {
            RunButton.onClick.AddListener(() =>
            {
                if (samplePlay)
                {
                    samplePlay.PlayRun();
                }
            });
        }
        if (AttackButton)
        {
            AttackButton.onClick.AddListener(() =>
            {
                if (samplePlay)
                {
                    samplePlay.PlayAttack();
                }
            });
        }
        if (DieButton)
        {
            DieButton.onClick.AddListener(() =>
            {
                if (samplePlay)
                {
                    samplePlay.PlayDie();
                }
            });
        }
        if (BlendButton)
        {
            BlendButton.onClick.AddListener(() =>
            {
                if (samplePlay)
                {
                    samplePlay.PlayBlend();
                }
            });
        }
    }