Exemplo n.º 1
0
    /*public override void AgentRewards()
     * {
     *  //Debug.Log("agent" + playerNumber + " recompensas");
     *  if (!dead && !IsDone() && !lastMan)
     *  {
     *      //verifyFire();
     *      verifyDanger();
     *
     *      if (!myGridPosition.Equals(oldGridPosition))
     *          myDistanceReward = myPlayerManager.CalculateDistanceEnemyPositionRewards(this);
     *
     *      applyRewardInFire();
     *
     *      //-----------------------------------------------------------------------------------------------------
     *      if (!dead && !IsDone())
     *      {
     *          applyRewardInDanger();
     *          applyRewardsToDistanceEnemyPositions();
     *      }
     *
     *      AddRewardToAgent(this, Config.REWARD_TIME_PENALTY, "Agente" + playerNumber + " sofreu penalidade de tempo");
     *
     *      ServiceLocator.getManager(scenarioId).GetLogManager().rewardResumePrint(GetReward(), GetCumulativeReward());
     *  }
     * }*/

    private void DropBomb()
    {
        if (bombPrefab)
        {
            float temp = Mathf.RoundToInt(transform.position.x) - transform.position.x >= 0.0f ? -0.0f : 0.0f;

            GameObject bomb = Instantiate(bombPrefab,
                                          new Vector3(Mathf.RoundToInt(transform.position.x) + temp,
                                                      transform.parent.position.y + 0.3f,
                                                      Mathf.RoundToInt(transform.position.z)),
                                          bombPrefab.transform.rotation,
                                          transform.parent);
            bomb.GetComponent <Bomb>().bomberman  = this;
            bomb.GetComponent <Bomb>().grid       = grid;
            bomb.GetComponent <Bomb>().scenarioId = scenarioId;

            myBombManager.addBomb(bomb);
            grid.enableObjectOnGrid(StateType.ST_Bomb, bomb.GetComponent <Bomb>().GetGridPosition());
            grid.enableObjectOnGrid(StateType.ST_Danger, bomb.GetComponent <Bomb>().GetGridPosition());
            bomb.GetComponent <Bomb>().CreateDangerZone(false);


            AddRewardToAgent(this, Config.REWARD_VALID_BOMB_ACTION, "Agente" + playerNumber + " colocou uma bomba");

            bombCount++;
            canDropBombs         = false;
            isInDanger           = true;
            areThereDangerAround = true;
        }
    }
Exemplo n.º 2
0
    private GameObject createBombGameObject(float x, float z)
    {
        GameObject bomb = Instantiate(bombPrefab,
                                      new Vector3(x + transform.parent.transform.position.x,
                                                  transform.parent.transform.position.y + 0.3f,
                                                  z + transform.parent.transform.position.z),
                                      bombPrefab.transform.rotation,
                                      transform.parent);

        bomb.GetComponent <Bomb>().grid       = grid;
        bomb.GetComponent <Bomb>().scenarioId = scenarioId;
        bombManager.addBomb(bomb);
        grid.enableObjectOnGrid(StateType.ST_Bomb, bomb.GetComponent <Bomb>().GetGridPosition());
        grid.enableObjectOnGrid(StateType.ST_Danger, bomb.GetComponent <Bomb>().GetGridPosition());
        bomb.GetComponent <Bomb>().CreateDangerZone(false);

        return(bomb);
    }