예제 #1
0
    public override IEnumerator SlowUpdate()
    {
        if (IsServer)
        {
            NNMA.MyAgent.speed = 10f;
        }
        NetworkedGM GM = FindObjectOfType <NetworkedGM>();

        while (MyCore.IsConnected)
        {
            if (GM.GameReady)
            {
                if (boxCount <= 8 && IsServer && !boxSpawn)
                {
                    //StartCoroutine(TryBoxSpawn());
                    boxSpawn = true;
                }
                else if (boxCount >= 8)
                {
                    ItemContainer[] temp = FindObjectsOfType <ItemContainer>();
                    boxCount = temp.Length;
                }
            }

            yield return(new WaitForSeconds(10));
        }
    }
예제 #2
0
    public void CaptureTime()
    {
        //15 seconds is amount needed to capture from nothing
        //Adjust time if hasn't reached it yet
        if (Mathf.Abs(captureTimer) < captureTime)
        {
            captureTimer = captureTimer + Time.deltaTime * captureDir;
        }

        //Check which team captured the flag
        else
        {
            NetworkedGM gm = GameObject.FindObjectOfType <NetworkedGM>();
            isCaptured = true;
            if (captureTimer <= -captureTime)
            {
                gm.AdjustPoints("GREEN", 1);
            }
            else if (captureTimer >= captureTime)
            {
                gm.AdjustPoints("RED", 1);
            }

            //Unlock next checkpoint
            //Move Lava
            //Adjust Plane
            //Adjust spawn locations
            gm.NextPhase();
        }
    }
예제 #3
0
    // Start is called before the first frame update
    void Start()
    {
        MyCam       = Camera.main;
        sensitivity = PlayerPrefs.GetFloat("sensitivity");
        if (sensitivity <= 0)
        {
            sensitivity = 5;
        }
        if (PlayerPrefs.GetFloat("volume") > 0)
        {
            AudioListener.volume = PlayerPrefs.GetFloat("volume");
        }
        MyName = this.transform.GetChild(7).GetComponent <Canvas>();
        MyRig  = GetComponent <Rigidbody>();

        myAnime = this.GetComponent <Animator>();
        gm      = FindObjectOfType <NetworkedGM>();
        JumpNum = MaxJumpNum;

        for (int i = 0; i < WeaponParent.transform.childCount; i++)
        {
            if (WeaponParent.transform.GetChild(i).GetComponent <Weapon>() != null)
            {
                WeaponParent.transform.GetChild(i).GetComponent <Weapon>().MyPos = WeaponParent.transform.GetChild(i).transform.localPosition;
            }
        }
    }
예제 #4
0
 // Start is called before the first frame update
 void Start()
 {
     gm = FindObjectOfType <NetworkedGM>();
 }