コード例 #1
0
    public void Ping()
    {
        if (!isLocalPlayer)
        {
            return;
        }

        if (!(Time.time - pingCooldownSeconds > pingLastUseTime))
        {
            return;
        }

        pingLastUseTime = Time.time;

        if (!pingIndicator)
        {
            pingIndicator = FindObjectOfType <CUI_Ping> ();
        }
        if (pingIndicator)
        {
            pingIndicator.TogglePingIcon(false);
            StartCoroutine(PingIndicatorReset());
        }

        CmdPingMaster();

        //show local effect
        Destroy(Instantiate(pingLocalEffect, this.gameObject.transform), pingEffectLifetime);
    }
コード例 #2
0
    //#######################################################################
    //called after scene loaded
    protected override void Start()
    {
        //if (crawlerClass != null)
        //    crawlerClass.Apply(this);

        base.Start();

        gameObject.name = pName;
        //foreach (MeshRenderer mr in GetComponentsInChildren<MeshRenderer>())
        //{
        //    mr.material = defaultMaterial;
        //    mr.material.color = playerColor;
        //}

        mesh = GetComponentInChildren <SkinnedMeshRenderer>();
        if (mesh != null)
        {
            mesh.material.color = playerColor;
        }
        else
        {
            ParticleSystem mm = GetComponentInChildren <ParticleSystem>();
            if (mm != null)
            {
                ParticleSystem.MainModule mm2 = mm.main;
                mm2.startColor = playerColor;
            }
        }

        nameTag.text = pName;

        //scale up the player object if this is the VR master [this is a temporary visualisation, to be removed once a proper Master representation is done]
        if (isMonster)
        {
            transform.localScale *= 1.3f;
            gameObject.tag        = "Crawler_Monster";
            //gameObject.GetComponentInChildren<CrawlerController>().enabled = false;
            //gameObject.SetActive (false);
        }

        if (isLocalPlayer)
        {
            FindObjectOfType <CUI_lowStat>().Register(GetComponent <Stats>());
            if (tpsUI)
            {
                tpsUI.SetActive(false);
            }

            //if (!isMonster) {
            FindObjectOfType <CUI_crosshair> ().registerCrawler(this);
            //}
        }

        if (!isLocalPlayer && !isMonster)
        {
            // Add this player to the team status panel
            FindObjectOfType <TeamStatusPanel>().Register(this);
        }

        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Confined;

        if (!pingIndicator)
        {
            pingIndicator = FindObjectOfType <CUI_Ping> ();
        }
        if (pingIndicator)
        {
            pingIndicator.TogglePingIcon(true);
        }

        /*if (!FindObjectOfType<Master> ()) {
         *      pingIndicator.TogglePingIcon (false);
         * }*/
    }