Esempio n. 1
0
    void Build()
    {
        if (m_towerToBuild != null)
        {
            Tour tourComponent = m_towerToBuild.GetComponent <Tour>();
            if (tourComponent != null)
            {
                m_IsBuilding = true;
                m_buildTime  = m_BuildingSpeedModifier * tourComponent.m_MinBuildingTime;
                if (m_Ressource == tourComponent.m_RessourceType)
                {
                    m_buildTime /= 2.0f;
                }

                m_buildingLane.AddTower(m_towerToBuild, m_buildTime);
            }
        }
    }
Esempio n. 2
0
    void Update()
    {
        if (Input.GetMouseButtonUp(0) && isReady)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            int        laneMask = 1 << LayerMask.NameToLayer("Lane");
            if (Physics.Raycast(ray, out hit, 100.0f, laneMask))
            {
                Lane lane = hit.collider.GetComponent <Lane>();
                if (lane != null && !lane.GetIsOccupied())
                {
                    isReady = false;
                    GameUI.Instance.ShowChoice(Input.mousePosition, lane);
                }
            }
        }

        if (Input.GetMouseButtonUp(1) && !isReady)
        {
            GameUI.Instance.BackChoice();
        }

        if (Input.GetMouseButtonUp(2) && DebugTower != null)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            int        laneMask = 1 << LayerMask.NameToLayer("Lane");
            if (Physics.Raycast(ray, out hit, 100.0f, laneMask))
            {
                Lane lane = hit.collider.GetComponent <Lane>();
                if (lane != null)
                {
                    lane.AddTower(DebugTower, 1);
                }
            }
        }
    }