コード例 #1
0
    void Start()
    {
        if (photonView.IsMine)
        {
            rigidBody       = this.gameObject.GetComponent <Rigidbody2D>();
            sprites         = this.gameObject.GetComponentsInChildren <SpriteRenderer>();//gets all the player sprites
            currentGameMode = FindObjectOfType <GameMode>();
            if (currentGameMode)
            {
                currentGameMode.AddPlayer(this);
            }

            audioManager = FindObjectOfType <AudioManager>();
            foreach (SpriteRenderer sprite in sprites)
            {
                if (sprite.name == "GunBase")
                {
                    gun = sprite;
                }
            }
        }
        cameraWork = this.gameObject.GetComponent <CameraWork>();
        if (cameraWork != null)
        {
            if (photonView.IsMine)
            {
                cameraWork.OnStartFollowing();
            }
        }
        else
        {
            Debug.LogError("Camera Not Working");
        }
        //instantiates the mouse target
        if (MouseTarget)
        {
            mouseTarget    = Instantiate(MouseTarget, Camera.main.ScreenToWorldPoint(Input.mousePosition), new Quaternion(0, 0, 0, 0));
            Cursor.visible = false;
        }
    }