예제 #1
0
    public void Start() // AI difficulty => ship placement + tactic
    {
        ShipsGrid aiGrid     = opponentGrid.GetComponent <ShipsGrid>();
        int       difficulty = Difficulty.difficultyValue;
        int       medium     = Random.Range(0, 2);
        int       hard       = Random.Range(0, 3);

        if (difficulty == 0)
        {
            aiTactic = (Tactic)0;
            aiGrid.AutoPlacement_Random();
        }
        else if (difficulty == 1)
        {
            aiTactic = (Tactic)1; // DEBUG
            //aiTactic = (Tactic)Random.Range(0, 2);
            if (medium == 0)
            {
                aiGrid.AutoPlacement_AntiDiagonal();
            }
            else
            {
                aiGrid.AutoPlacement_Coasts();
            }
        }
        else
        {
            aiTactic = (Tactic)2; // DEBUG
            //aiTactic = (Tactic)Random.Range(1, 3);

            if (hard == 0)
            {
                aiGrid.AutoPlacement_Random();
            }
            else if (hard == 1)
            {
                aiGrid.AutoPlacement_AntiDiagonal();
            }
            else
            {
                aiGrid.AutoPlacement_Coasts();
            }
        }

        opponentTerrain.gameObject.SetActive(false);

        foreach (Transform child in opponentGrid.transform)
        {
            child.gameObject.SetActive(false);
        }
    }
예제 #2
0
 public void P_Anti_Diagonal() => grid.AutoPlacement_AntiDiagonal();