Exemplo n.º 1
0
    //Loading battle on the same battlefield, hardcoded pq o unity e fdp e eh mais rapido anyways
    //Quartenium formula x = sin(Y)sin(Z)cos(X)+cos(Y)cos(Z)sin(X) y = sin(Y)cos(Z)cos(X)+cos(Y)sin(Z)sin(X) z = cos(Y)sin(Z)cos(X)-sin(Y)cos(Z)sin(X) w = cos(Y)cos(Z)cos(X)-sin(Y)sin(Z)sin(X)
    public void Load()
    {
        //Cache both teams
        P1team = player.playerTeam;
        P2team = player.enemyTeam;
        IAtype = player.IAtype;

        //Clear actionPoints
        for (int i = 0; i < 6; i++)
        {
            P1team [i].actionPoint = 0;
        }
        for (int i = 0; i < 6; i++)
        {
            P2team [i].actionPoint = 0;
        }

        LoadAndermonObject(); //Carrega os andermon como objeto no battlefield
        LoadUI();             //Load the UI
        useIA = true;         //Activates IA, there's no multplayer yet
        if (useIA)
        {
            LoadIA();                //Get the IA script
        }
        Debug.Log("Calling battle configuration");



        turnManager.ConfigureBattle();         //Decides first turn and set handcaps if necessary
    }
Exemplo n.º 2
0
    //Codigo de interacao com o ambiente, manda um laser pra onde o player ta olhando e ve que tipo de objeto que o laser colidiu
    void Examine()
    {
        RaycastHit2D hit;
        Vector2      startPoint;
        Vector2      direction;
        float        distance = 3.0f;

        //Checa para onde vou mandar o laser
        if (facingDirection == Direction.down)
        {
            startPoint = new Vector2(transform.position.x, transform.position.y - 17);
            direction  = Vector2.up;
            direction *= -1;
        }
        else if (facingDirection == Direction.up)
        {
            startPoint = new Vector2(transform.position.x, transform.position.y + 17);
            direction  = Vector2.up;
        }
        else if (facingDirection == Direction.right)
        {
            startPoint = new Vector2(transform.position.x + 17, transform.position.y);
            direction  = Vector2.right;
        }
        else           //left
        {
            startPoint = new Vector2(transform.position.x - 17, transform.position.y);
            direction  = Vector2.right;
            direction *= -1;
        }

        //checa o que o laser colidiu
        if (hit = Physics2D.Raycast(startPoint, direction, distance))
        {
            if (hit.collider.tag == "NPC")                         //essa e a tag de npc padrao que so fala
            {
                hit.collider.SendMessage("talk", facingDirection); //Manda pro npc o lado em que o player esta olhando
            }
            if (hit.collider.tag == "AndermonP")                   //essa e a tag de andermon que nao se mexe
            {
                AndermonPassive script;
                inCombat  = true;
                script    = hit.collider.GetComponent <AndermonPassive>();
                enemyTeam = script.GenerateTeam();
                script.TalkToPlayer(facingDirection);
                currentSceneBattleName = script.Terrain();
                IAtype = script.IAtype;
                StartBattle();
                GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0);
                animator.SetInteger("HorizontalSpeed", 0);
                animator.SetInteger("VerticalSpeed", 0);
            }
        }
    }
Exemplo n.º 3
0
    //Generates the enemy team for the player
    public Andermon[] GenerateTeam()
    {
        //Temporary solution, we dont have a manager codded YET
        IAtype = ArtificialIntelligence.IAlevel.wildEasy;
        if (Random.Range(1, 7) % 2 != 0)
        {
            enemyTeam [1] = new Andermon(0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        else
        {
            enemyTeam [1] = new Andermon(2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        if (Random.Range(1, 7) % 2 != 0)
        {
            enemyTeam [2] = new Andermon(0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        else
        {
            enemyTeam [2] = new Andermon(2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        if (Random.Range(1, 7) % 2 != 0)
        {
            enemyTeam [3] = new Andermon(0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        else
        {
            enemyTeam [3] = new Andermon(2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        if (Random.Range(1, 7) % 2 != 0)
        {
            enemyTeam [4] = new Andermon(0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        else
        {
            enemyTeam [4] = new Andermon(2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        if (Random.Range(1, 7) % 2 != 0)
        {
            enemyTeam [5] = new Andermon(0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }
        else
        {
            enemyTeam [5] = new Andermon(2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        }

        enemyTeam [0] = new Andermon(2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        //enemyTeam [1] = new Andermon (0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        //enemyTeam [2] = new Andermon (0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        //enemyTeam [3] = new Andermon (0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        //enemyTeam [4] = new Andermon (2, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        //enemyTeam [5] = new Andermon (0, "Ratty", "Ratty", 1, Andermon.Type.normal, 6, 6, 2, 0, 1, 45, Andermon.Condition.alive);
        return(enemyTeam);
    }