示例#1
0
 // Start is called before the first frame update
 void Start()
 {
     _deskzone        = FindObjectOfType <Deskzone>();
     _warpzoneManager = FindObjectOfType <WarpzoneManager>();
     _virtualCity     = FindObjectOfType <VirtualCity>();
     _mainCamera      = Camera.main;
 }
示例#2
0
        new public void Awake()
        {
            if (AvatarPrefab == null)
            {
                AvatarPrefab = Resources.Load <GameObject>("Primary_Avatar");
            }

            if (DebugText == null)
            {
                DebugText = FindObjectOfType <TMP_Text>();
            }

            _deskzone = FindObjectOfType <Deskzone>();

            Application.logMessageReceived += (message, trace, type) =>
            {
                if (!DebugText.text.EndsWith(message + "\n"))
                {
                    DebugText.text += message + "\n";
                }

                int count = 0;
                foreach (char c in DebugText.text)
                {
                    if (c == '\n')
                    {
                        count++;
                    }
                }

                count = count - 35;
                if (count > 0)
                {
                    var index = 0;
                    for (int i = 0; i < count; i++)
                    {
                        index = DebugText.text.IndexOf('\n', index + 1);
                    }

                    DebugText.text = DebugText.text.Substring(index);
                }
            };
            base.Awake();
        }
示例#3
0
    private void Start()
    {
        _view        = GetComponent <PhotonView>();
        _virtualCity = FindObjectOfType <VirtualCity>();
        if (_view.IsMine)
        {
            Mine = this;
        }

        if (TargetManager.Instance.Type == TargetManager.PlayerType.Primary)
        {
            _deskzone = FindObjectOfType <Deskzone>();
        }

        if ((string)GetComponent <PhotonView>().Owner.CustomProperties["Class"] == TargetManager.PlayerType.Primary.ToString())
        {
            Type = TargetManager.PlayerType.Primary;
            if (TargetManager.Instance.Type == TargetManager.PlayerType.Primary)
            {
                _deskzone.Inside  += () => { ToggleVisibility(false); };
                _deskzone.Outside += () => { ToggleVisibility(true); };
            }
        }
        else
        {
            Type = TargetManager.PlayerType.Secondary;
            SecondaryAvatars.Add(this);

            if (TargetManager.Instance.Type == TargetManager.PlayerType.Primary)
            {
                var conePrefab = FindObjectOfType <WarpzoneManager>().ViewConePrefab;
                var cone       = Instantiate(conePrefab);
                cone.transform.parent                  = transform;
                cone.transform.localPosition           = conePrefab.transform.localPosition;
                cone.transform.localRotation           = conePrefab.transform.localRotation;
                cone.transform.localScale              = conePrefab.transform.localScale;
                cone.GetComponent <Renderer>().enabled = false;
            }
        }
        AvatarCreated?.Invoke(this);
    }
示例#4
0
    void Start()
    {
        _view      = GetComponent <PhotonView>();
        _deskzone  = FindObjectOfType <Deskzone>();
        _transform = transform;
        Debug.Log("Init " + (IsRight ? "Right" : "Left"));
#if UNITY_ANDROID
        if (_view.IsMine)
        {
            if (IsRight)
            {
                transform.parent = GameObject.Find("RightHandAnchor").transform;
            }
            else
            {
                transform.parent = GameObject.Find("LeftHandAnchor").transform;
            }
            transform.localScale    = Vector3.one;
            transform.localPosition = Vector3.zero;
            transform.localRotation = Quaternion.identity;
        }
#endif
    }