EloiStree / 2024_05_23_HelloStreamDeckGirleek

In the context of Girleek and a QA testing workshop. We are going to learn how to remote control game with code in a steam deck hub way.
0 stars 0 forks source link

Topic: GirleekMono #43

Open EloiStree opened 4 months ago

EloiStree commented 4 months ago

Des scripts à déposer

EloiStree commented 4 months ago
EloiStree commented 4 months ago
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GirlMono_ChangeColorOnClickMono : MonoBehaviour
{

    public Color m_color;
    public MeshRenderer m_target;

    void Start()
    {
        m_target.material.color = m_color;
    }

    void Update()
    {
        SetRandomColor();
    }

    [ContextMenu("Set Default Color")]
    public void SetDefaultColor() {

        m_target.material.color = m_color;
    }

    [ContextMenu("Set Random Color")]
    public void SetRandomColor() {
        m_target.material.color = new Color(
               Random.Range(0f, 1f), Random.Range(0f, 1f),
               Random.Range(0f, 1f), 1);
    }
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class GirlMono_OnPressReleaseObject3D : MonoBehaviour
{
    public bool m_isPressed = false;
    public UnityEvent m_onPress;
    public UnityEvent m_onRelease;

    private void OnMouseDown()
    {

        m_isPressed = true;
        m_onPress.Invoke();
    }

    private void OnMouseUp()
    {

        m_isPressed = false;
        m_onRelease.Invoke();
    }

    public void DisplayMessage(string message)
    {
        Debug.Log(message);

    }
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;

public class GirlMono_OnPressReleasePanel2D : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{

    public bool m_isPress;
    public UnityEvent m_onPress;
    public UnityEvent m_onRelease;

    public void OnPointerDown(PointerEventData eventData)
    {
        m_isPress = true;
        m_onPress.Invoke();
    }

    public void OnPointerUp(PointerEventData eventData)
    {
        m_isPress = false;
        m_onRelease.Invoke();
    }

}