예제 #1
0
    private IEnumerator ResetFlagCoroutine()
    {
        m_flag.Detach();
        RpcShowFlag(false);
        m_flag.gameObject.SetActive(false);

        yield return(new WaitForSeconds(m_respawnDelay));

        if (m_remainingSpawns.Count == 0)
        {
            foreach (Transform spawn in m_spawns)
            {
                m_remainingSpawns.Add(spawn);
            }
        }

        m_flag.gameObject.SetActive(true);
        RpcShowFlag(true);

        int       random        = Random.Range(0, m_remainingSpawns.Count);
        Transform selectedSpawn = m_remainingSpawns[random];

        Vector3 safePosition = selectedSpawn.position;

        safePosition.y            = 0;
        m_flag.transform.position = safePosition;
        m_remainingSpawns.Remove(selectedSpawn);

        m_flag.ForceUpdatePosition();
    }