Example #1
0
    private void GetKey(RightEvent rightEvent, LeftEvent leftEvent, UpEvent upEvent)
    {
        timeVal -= Time.deltaTime;
        float h = Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");

        if (h > 0)
        {
            if (timeVal <= 0)
            {
                timeVal = DELTIME;
                rightEvent();
            }
        }
        else if (h < 0)
        {
            if (timeVal <= 0)
            {
                timeVal = DELTIME;
                leftEvent();
            }
        }
        if (v > 0)
        {
            if (timeVal <= 0)
            {
                timeVal = DELTIME;
                upEvent();
            }
        }
    }
    void RightClick()
    {
        IEvent eve = new RightEvent();

        SfAddEvent.Instance.Trigger((int)ProtocalID.Move_Main, eve);
        string str = string.Format("向右 mainID:{0} ", eve.Type);

        Debug.Log(str);
    }
Example #3
0
    public void Initialize(LeftEvent leftEvent, RightEvent rightEvent, UpEvent upEvent, DownEvent downEvent)
    {
        Initialize();

        this._leftEvent = leftEvent;
        this._rightEvent = rightEvent;
        this._upEvent = upEvent;
        this._downEvent = downEvent;
    }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     Debug.Log("running");
     rEvent = new RightEvent(this.NextRoad);
     lEvent = new LeftEvent(this.LastRoad);
     uEvent = new UpEvent(this.Act);
     client = new UnityClient();
     if (client.Init("192.168.16.112", 9100) < 0)
     {
         Debug.Log("Connect peer failed");
         return;
     }
     Debug.Log("Init ok");
 }