Exemple #1
0
    void Start()
    {
        ai AI = GetComponent <ai> ();

        discNumber = 0;
        discs      = GameObject.Find("discs");
        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                float x = -0.437f + ((0.439f - (-0.437f)) / 7.0f * i);
                float y = -0.437f + ((0.439f - (-0.437f)) / 7.0f * j);
                float z = -0.5f;
                position [i, j]     = new Vector3(x, y, z);
                discPosition [i, j] = null;
            }
        }

        // プレハブを取得
        //GameObject prefab = (GameObject)Resources.Load ("Prefabs");//Prefabs/子フォルダ
        SetDisc(3, 3, true);
        SetDisc(3, 4, false);
        SetDisc(4, 3, false);
        SetDisc(4, 4, true);       //特定位置にDiscをセット
        turnPlayer = false;        //黒ターンからスタート
    }
Exemple #2
0
        public static void stealTechno(byte player, byte adv)
        {
            int techno = selectRandomUndiscoveredTechno(player, adv);

            if (techno != -1)
            {
                Form1.game.playerList[player].technos[techno].researched = true;

                if (Form1.game.playerList[player].currentResearch == techno)
                {
                    if (player == Form1.game.curPlayerInd)
                    {
                        uiWrap.chooseNextTechno(
                            player,
                            "Your spies succesfully stole " + Statistics.technologies[Form1.game.playerList[player].currentResearch].name.ToLower() + " from " + Statistics.civilizations[Form1.game.playerList[adv].civType].name + ".  Please chose your next research.",
                            "Intelligence"
                            );
                    }
                    else
                    {
                        ai Ai = new ai();
                        Form1.game.playerList[player].currentResearch = ai.randomTechnology(player);
                    }
                }
            }
        }
Exemple #3
0
        public static void chooseNextTechno(byte player, string text, string caption)
        {
            string technoName = Statistics.technologies[Form1.game.playerList[player].currentResearch].name;

            ai Ai = new ai();

            byte[] technos    = ai.returnDisponibleTechnologies(player);
            byte   nextTechno = ai.randomTechnology(player);

            string[] choices = technoListStrings(player, technos);

            userChoice uc = new userChoice(
                caption,
                text,
                choices,
                0,
                language.getAString(language.order.uiAccept),
                language.getAString(language.order.uiOpenTechnoTree)
                );

            uc.ShowDialog();
            int res = uc.result;

            if (res == -1)
            {             // science tree
                Form1.game.playerList[player].currentResearch = (byte)nextTechno;

                sciTree sciTree1 = new sciTree();
                sciTree1.ShowDialog();
            }
            else
            {             // accept
                Form1.game.playerList[player].currentResearch = (byte)technos[res];
            }
        }
Exemple #4
0
    public void Posted()
    {
        String input = entry1.Text;

        entry1.Text = "";
        ai ai = new ai();

        try {
            input = input.Replace("!!", commands [0]);
        } catch {
        }
        commands.Clear();
        commands.Add(input);
        if (!string.IsNullOrEmpty(input) || !string.IsNullOrWhiteSpace(input))
        {
            ai.ai_pipe(input);
        }
    }
Exemple #5
0
    void Update()
    {
        //finite state machine
        switch (state)
        {
        case ai.Attack:
            Attack();
            break;

        case ai.Die:
            Die();
            break;

        case ai.Patrol:
            Patrol();
            break;

        case ai.Follow:
            Follow();
            break;

        default:
            Patrol();
            break;
        }

        Vector3 playerPosition = PlayerController.instance.transform.position;

        if (Vector3.Distance(playerPosition, transform.position) < 7)
        {
            state = ai.Follow;
        }

        if (Vector3.Distance(playerPosition, transform.position) < 5)
        {
            state = ai.Attack;
        }

        if (currentHealth < 0)
        {
            state = ai.Die;
        }
    }
Exemple #6
0
 private void Awake()
 {
     myAi = GetComponent <ai>();
 }
Exemple #7
0
 void Awake1()
 {
     script         = myEnemy.GetComponent <ai>();
     script.enabled = true;
 }