예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        currentState = buildState.NotBuilding;
        wallPosX     = -1000f;
        wallPosZ     = -1000f;

        buildChoice = 0;

        for (int i = 0; i < 5; i++)
        {
            wallColumns[i] = null;
        }

        columnArrays = new Array[columnCount];

        for (int i = 0; i < columnCount; i++)
        {
            columnArrays[i] = new Array(9, i);
        }

        igui = FindObjectOfType <IngameUI>();

        state = State.NotBuilding;
        //illegalTouchAnimator.SetBool("ShowText",false);

        cm = FindObjectOfType <CoinManager>();
    }
예제 #2
0
    void inputHandler()
    {
        if (FindObjectOfType <IngameUI>().playmode != IngameUI.Playmode.Shoot)
        {
            RaycastHit hit;
            Ray        ray = camera.ScreenPointToRay(Input.mousePosition + Vector3.up * touchShiftUp);
            if (Physics.Raycast(ray, out hit, 100f, mask))
            {
                if (Input.GetMouseButtonDown(0))
                {
                    currentState = buildState.StartedBuilding;
                }
                else if (Input.GetMouseButton(0))
                {
                    currentState = buildState.DuringBuilding;
                }
                else if (Input.GetMouseButtonUp(0))
                {
                    currentState = buildState.FinishedBuilding;
                }
                else
                {
                    currentState = buildState.NotBuilding;
                }

                if (FindObjectOfType <IngameUI>().buildchoice == IngameUI.BuildChoice.Wall)
                {
                    buildChoice = 0;
                }
                if (FindObjectOfType <IngameUI>().buildchoice == IngameUI.BuildChoice.Turret)
                {
                    buildChoice = 1;
                }
            }
        }
    }