Exemple #1
0
    private void OnFire(SocketIOEvent obj)
    {
        ShootMissile shot = players[JsonHelper.GetStringFromJson(obj.data["id"].ToString())].Player.GetComponent <ShootMissile>();

        Debug.Log("shot ");
        shot.Fire();
    }
Exemple #2
0
    // Update is called once per frame
    void Update()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
        var z = Input.GetAxis("Vertical") * Time.deltaTime * 150.0f;

        transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
        currentPosition = transform.position;
        currentrotation = transform.rotation;

        if (currentPosition != oldposition)
        {
            GameNetworkManager.CammandMove(transform.position);
            oldposition = currentPosition;
        }
        if (currentrotation != oldrotation)
        {
            GameNetworkManager.CammandRotate(transform.rotation);
            Debug.Log("currentrotaiton " + transform.rotation);
            oldrotation = currentrotation;
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            GameNetworkManager.CammandFire();
            sm.Fire();
        }
    }