Esempio n. 1
0
    /* *************
     * LOGIC
     * ===============*/
    public void onDataRecieved(network_data msg)
    {
        if (msg == null)
        {
            return;
        }
        if (msg.header != this.recieveHeader)
        {
            return;
        }

        string id = msg.sender.GetInstanceID().ToString();

        if (!this._networkData.ContainsKey(id))
        {
            if (this._networkData.Count > this._maxSenders)
            {
                return;
            }
            this._networkData.Add(id, msg);
        }
        else
        {
            this._networkData[id] = msg; // Update existing data
        }

        // Update current status
        this.logicUpdate();
    }
Esempio n. 2
0
 /* *************
  * LOGIC
  * ===============*/
 public void onDataRecieved(network_data msg)
 {
     if (msg == null || msg.header != "active")
     {
         return;
     }
     this.setEnabled(msg.data == 1);
 }
Esempio n. 3
0
 /* *************
  * LOGIC
  * ===============*/
 public void onDataRecieved(network_data msg)
 {
     if (msg == null || msg.header != "active")
     {
         return;
     }
     this._animator.SetInteger("status", msg.data);
 }
Esempio n. 4
0
    /* *************
     * NETWORKING
     * ===============*/
    public void onDataRecieved(network_data msg)
    {
        if (msg == null)
        {
            return;
        }

        if (msg.header == "active")
        {
            this._isActive = (msg.data == 1);
        }
        else if (msg.header == "reverse")
        {
            this.speed = -this.speed;
        }

        this.setBelt(this._isActive);
    }
Esempio n. 5
0
    /* *************
     * LOGIC
     * ===============*/
    public void onDataRecieved(network_data msg)
    {
        if (msg == null || msg.header != "active")
        {
            return;
        }
        bool enabled = msg.data == 1;

        if (enabled && openTime > 0)
        {
            if (this._timer != null)
            {
                this._timer.Stop();
            }
            this._timer = util_timer.Simple(openTime, () => {
                this._enabled = false;
            });
        }

        this._enabled = enabled;
    }