예제 #1
0
    /// <summary>
    /// Изменяем параметры планеты
    /// </summary>
    private void CheckNewParametrs()
    {
        switch (typeThisPlanet)
        {
        case TypePlanet.Empty:
        {
            break;
        }

        case TypePlanet.Enemy:
        {
            break;
        }

        case TypePlanet.Player:
        {
            materialPlanet.material.color = Color.red;
            if (!interfacePlanet)
            {
                interfacePlanet = InterfacePool.Instance.AddInterface(transform.position);
            }
            gameObject.tag = "Player";
            interfacePlanet.gameObject.SetActive(true);
            interfacePlanet.ViewText(numberShips.ToString());
            break;
        }

        default:
        {
            break;
        }
        }
    }
예제 #2
0
    /// <summary>
    /// Добавляем интерфейс
    /// </summary>
    public InterfacePlanet AddInterface(Vector3 targetPosition)
    {
        bool            isFind           = false;
        InterfacePlanet currentInterface = new InterfacePlanet();

        for (int i = 0; i < interfacesPlanets.Count; i++)
        {
            if (!interfacesPlanets[i].gameObject.activeSelf)
            {
                currentInterface = interfacesPlanets[i];
                isFind           = true;
                break;
            }
        }

        if (!isFind)
        {
            currentInterface = Instantiate(prefabInterface, Vector3.zero, Quaternion.identity, parentInterface).GetComponent <InterfacePlanet>();
            interfacesPlanets.Add(currentInterface);
        }

        currentInterface.transform.position = NewPosition(targetPosition);

        return(currentInterface);
    }