Ejemplo n.º 1
0
 public static void StartTurn()
 {
     CurrentSelected.BeginTurn();
     CurrentSelected.MoveAction();
 }
Ejemplo n.º 2
0
    void Update()
    {
        if (Input.GetMouseButtonUp(1))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, Mathf.Infinity))
            {
                if (hit.collider.tag == TurnManager.CurrentTeam)
                {
                    if (!hit.collider.GetComponent <TacticsMove>().turn&& !hit.collider.GetComponent <TacticsMove>().passedTurn)
                    {
                        TurnManager.CurrentSelected.EndTurn();
                        hit.collider.GetComponent <TacticsMove>().BeginTurn();
                        TacticsMove currentTm = hit.collider.GetComponent <TacticsMove>();
                        TurnManager.CurrentSelected = currentTm;
                        currentTm.BeginTurn();
                        currentTm.MoveAction();

                        if (equipmentDisplay.isActiveAndEnabled)
                        {
                            equipmentDisplay.UpdateEquipment(true);
                        }
                    }
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            CraftManager.UpdateRecipes();
            GetComponent <Recipe>().Craft();
        }

        if (camFollow && TurnManager.CurrentTeam == "Player")
        {
            newCameraPos = new Vector3(newCameraPos.x, cameraBase.transform.position.y, newCameraPos.z);
            cameraBase.transform.position = Vector3.MoveTowards(cameraBase.transform.position, newCameraPos, cameraBase.GetComponent <CameraControl>().panSpeed);
            if (cameraBase.transform.position == newCameraPos)
            {
                camFollow = false;
            }
        }

        if (!TurnManager.combatInitialized)
        {
            if (TurnManager.UnitList.Count > 0)
            {
                TurnManager.InitCombat();
                follow = true;
            }
            else
            {
                follow = false;
            }
        }

        if (follow)
        {
            transform.position = TurnManager.CurrentSelected.transform.position + new Vector3(0, 2, 0);
        }
    }