Exemplo n.º 1
0
 void Awake()
 {
     Debug.Log("NetStreamer Awake");
     m_receiver = gameObject.GetComponent <NetClPlayerManager>();
     m_sender   = gameObject.GetComponent <NetSvPlayerManager>();
     m_stateToSend.Invalidate();
 }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        //get Debug Text object
        GameObject obj = GameObject.Find("DebugGui");

        output      = obj.GetComponent <GUIText>();
        output.text = "";

        //own stuff
        plm = gameObject.GetComponent <NetClPlayerManager>();
    }
Exemplo n.º 3
0
    public void Process()
    {
        float inMotionH = Input.GetAxis("Horizontal");
        float inMotionV = Input.GetAxis("Vertical");
        float inRun     = Convert.ToSingle(Input.GetButton("Run"));
        float inJump    = Convert.ToSingle(Input.GetButton("Jump"));
        float inUse     = Convert.ToSingle(Input.GetButton("Use"));
        float inAttack  = Convert.ToSingle(Input.GetButton("Attack"));

        shoot = Input.GetButton("Attack");
        ///DEBUG
//		PlayerStats stats = GetComponent<PlayerStats>();
//		if (stats.id == 2)
        NetClPlayerManager plm = GetComponent <NetClPlayerManager>();

        if (plm.playerControllerId == 1)
        {
            i++;
            if (i > 20)
            {
                i = 0;
                j = 2 - j;
            }
            inMotionV = Convert.ToSingle(j - 1);
        }
        ///DEBUG

        //Debug.Log (inMotionH);
        if (inMotionH >= 0.1f)
        {
            inputs[sectMotionH] = 2;
        }
        else if (inMotionH <= -0.1f)
        {
            inputs[sectMotionH] = 0;
        }
        else
        {
            inputs[sectMotionH] = 1;
        }

        if (inMotionV >= 0.1f)
        {
            inputs[sectMotionV] = 2;
        }
        else if (inMotionV <= -0.1f)
        {
            inputs[sectMotionV] = 0;
        }
        else
        {
            inputs[sectMotionV] = 1;
        }

        if (inRun > 0.0f)
        {
            inputs[sectRun] = 1;
        }
        else
        {
            inputs[sectRun] = 0;
        }

        if (inJump > 0.0f)
        {
            inputs[sectJump] = 1;
        }
        else
        {
            inputs[sectJump] = 0;
        }

        if (inUse > 0.0f)
        {
            inputs[sectUse] = 1;
        }
        else
        {
            inputs[sectUse] = 0;
        }

        if (inAttack > 0.0f)
        {
            inputs[sectAttack] = 1;
        }
        else
        {
            inputs[sectAttack] = 0;
        }

        Decode();
        //hack
        //motionH = inMotionH;
        //motionV = inMotionV;
        //run = inRun;
        //jump = inJump;
    }