상속: MonoBehaviour
예제 #1
0
 public static void PlayButtonClickedSound(ButtonBehaviour target)
 {
     if (CurrentUserInfo.IsSoundEnabled)
     {
         target.GetComponent <AudioSource>().Play();
     }
 }
예제 #2
0
    // FUNCTIONS.
    void Update()
    { // Hit object with raycast.
        RaycastHit hit;

        // Change image color.
        if (Physics.Raycast(raycastOutPoint.position, transform.forward, out hit, Mathf.Infinity))
        {
            transformImage = hit.transform;
            transformImage.GetComponent <Image>().color = new Color32(150, 150, 150, 255);
        }
        else
        {
            if (transformImage != null)
            {
                if (transformImage.GetComponent <Image>() != null)
                {
                    transformImage.GetComponent <Image>().color = Color.white;
                }
            }
        }
        // Call function on raycast hit.
        if (Input.GetKeyDown(GoTrigger))
        {
            if (Physics.Raycast(raycastOutPoint.position, transform.forward, out hit, Mathf.Infinity))
            {
                ButtonBehaviour target = hit.transform.GetComponent <ButtonBehaviour>();
                target.Active();
            }
        }
    }
예제 #3
0
    // Start is called before the first frame update
    void Start()
    {
        _gameController.CharacterAmount = _characterObjects.Length;
        _characterAmount = _gameController.CharacterAmount;
        _playerAmount    = _gameController.PlayerAmount;

        for (int i = 1; i <= _characterAmount; i++)
        {
            ButtonBehaviour beh = Instantiate(_characterButtonBehaviour[i - 1], this.transform);
            beh.CharacterNumber = i;
            beh.CharacterSetup  = this;
            beh.CharacterObject = _characterObjects[i - 1];
        }

        //_player1Stats.ResetTexts();
        //_player2Stats.ResetTexts();

        foreach (var item in _characterObjects)
        {
            PlayerBehaviour beh = item.GetComponent <PlayerBehaviour>();
            CheckValues(beh.PlayerStats);
        }

        SetValuesSliders(_player1Stats);
        SetValuesSliders(_player2Stats);
    }
예제 #4
0
    public override void OnInspectorGUI()
    {
        ButtonBehaviour myTarget = (ButtonBehaviour)target;

        DrawPropertiesExcluding(serializedObject, new string[] { "flatUpgradeAmount", "widthIncrease" });
        EditorGUI.BeginChangeCheck();

        switch (myTarget.upgradeType)
        {
        case ButtonBehaviour.UpgradeType.None:
            //Print nothing
            break;

        case ButtonBehaviour.UpgradeType.Flat:
            EditorGUILayout.PropertyField(flatUpProp, true);
            break;

        case ButtonBehaviour.UpgradeType.Width:
            EditorGUILayout.PropertyField(widthUpProp, true);
            break;

        default:
            Debug.Log("UpgradeType not implemented in custom inspector");
            break;
        }

        // Apply changes to the serializedProperty - always do this in the end of OnInspectorGUI.
        serializedObject.ApplyModifiedProperties();
    }
        // Shows the banner view on the screen.
        public void ShowBannerView()
        {
            Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name);
            dummyAd = AdBehaviour.ShowAd(prefabAd, getRectTransform(prefabAd).anchoredPosition);
            ButtonBehaviour buttonBehaviour = dummyAd.GetComponentInChildren <ButtonBehaviour>();

            buttonBehaviour.OnAdOpening          += OnAdOpening;
            buttonBehaviour.OnLeavingApplication += OnAdLeavingApplication;
        }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        instance = this;
        gotoBtn.onClick.RemoveAllListeners();
        gotoBtn.onClick.AddListener(GotoIndex);

        currentIndexBtn.onClick.RemoveAllListeners();
        currentIndexBtn.onClick.AddListener(GetCurrentIndex);
    }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     defaultMaterial = renderer.material;
     downMaterial = selectedMaterial;
     upMaterial = defaultMaterial;
     selected = false;
     buttonControl = gameObject.AddComponent<ButtonBehaviour>();
     buttonControl.mouseOver = selectedMaterial;
     name = pageName;
 }
예제 #8
0
    private void RaycastCheck()
    {
        RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.position + Vector3.forward, Mathf.Infinity, _checkLayer);

        if (hit.collider != null)
        {
            ButtonBehaviour button = hit.collider.GetComponent <ButtonBehaviour>();
            button?.TaskOnClick(_playerNumber);
        }
    }
 public void ChangeBehaviour()
 {
     if (currBehaviour == ButtonBehaviour.START)
     {
         currBehaviour   = ButtonBehaviour.PAUSE;
         buttonText.text = "PAUSE";
     }
     else
     {
         currBehaviour   = ButtonBehaviour.START;
         buttonText.text = "START";
     }
 }
 // Use this for initialization
 void Start()
 {
     door = GetComponentInChildren<DoorBehaviour> ();
     doorRb = GetComponentInChildren<Rigidbody2D> ();
     button = GetComponentInChildren<ButtonBehaviour> ();
 }
 public void Start()
 {
     currBehaviour   = ButtonBehaviour.START;
     buttonText.text = "START";
 }
예제 #12
0
파일: Button.cs 프로젝트: komakinex/Unity
 void Start()
 {
     handler = gameObject.GetComponent(typeof(ButtonBehaviour)) as ButtonBehaviour;
 }
예제 #13
0
파일: Button.cs 프로젝트: w52samaru/Unity
 void Start()
 {
     handler = gameObject.GetComponent(typeof(ButtonBehaviour)) as ButtonBehaviour;
 }
 private void CreateButtonBehavior()
 {
     buttonBehaviour              = new ButtonBehaviour();
     buttonBehaviour.OnAdOpening += OnAdOpening;
 }
예제 #15
0
 private void CreateButtonBehavior()
 {
     buttonBehaviour                       = new ButtonBehaviour();
     buttonBehaviour.OnAdOpening          += OnAdOpening;
     buttonBehaviour.OnLeavingApplication += OnAdLeavingApplication;
 }
예제 #16
0
 public void Start()
 {
     GM     = GameObject.FindGameObjectWithTag("Managers").GetComponent <GameManager>();
     button = GM.GetComponent <ButtonBehaviour>();
 }
예제 #17
0
 private void CreateButtonBehavior()
 {
     buttonBehaviour = new ButtonBehaviour();
 }
 internal void CreateButtonBehavior()
 {
     buttonBehaviour = new ButtonBehaviour();
 }