Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        _robot = new PetriNet("Assets/RedesPetri/Robo2.pflow");

        //Define status conform PetriNet
        _life = _robot.GetPlaceByLabel("Life");
        //update values for status
        _life.AddCallback(RefreshTextos, "refreshLife", Tokens.InOrOut);

        //Define status conform PetriNet
        _ammo = _robot.GetPlaceByLabel("Ammo");
        //update values for status
        _ammo.AddCallback(RefreshTextos, "refreshAmmo", Tokens.InOrOut);

        //Define status conform PetriNet
        _fuel = _robot.GetPlaceByLabel("Fuel");
        //update values for status
        _fuel.AddCallback(RefreshTextos, "refreshFuel", Tokens.InOrOut);

        _currentPlayer = GameObject.FindGameObjectWithTag("Player");

        RefreshTextos();

        directionChoice = Random.Range(1, 5);

        RandomDirection();
    }
Example #2
0
    void Start()
    {
        _wheels = GetComponentsInChildren <Wheel>();

        _rigidbody = GetComponent <Rigidbody>();
        _rigidbody.centerOfMass = centerOfMass.localPosition;

        _rover = new PetriNet("Assets/RedesPetri/Rover.pflow");

        // ajustando a multiplicidade do arco posterior ao Place "SoldierRescue" conforme o nĂºmero de soldados da cena
        _rover.GetConnection(17, 18).Multiplicity = GameManager.Instance.GetSoldierInScene();

        //Define status conform PetriNet
        _fuel     = _rover.GetPlaceByLabel("Fuel");
        _ammo     = _rover.GetPlaceByLabel("Ammo");
        _life     = _rover.GetPlaceByLabel("Life");
        _sdRescue = _rover.GetPlaceByLabel("SoldierRescue");

        //update values for status
        _fuel.AddCallback(RefreshTextos, "refreshFuel", Tokens.InOrOut);
        _ammo.AddCallback(RefreshTextos, "refreshAmmo", Tokens.InOrOut);
        _life.AddCallback(RefreshTextos, "refreshLife", Tokens.InOrOut);
        _sdRescue.AddCallback(RefreshTextos, "refreshSoldier", Tokens.InOrOut);

        RefreshTextos();

        GameManager.Instance.CanvasManager.SetAmmoMensage("Arma desativada");

        pool = GameObject.FindGameObjectWithTag("PoolShoot").GetComponent <PoolShoot>();
    }
Example #3
0
    void Start()
    {
        player = new PetriNet("Assets/player.pflow");
        rb2d   = GetComponent <Rigidbody2D>();
        pontos = player.GetPlaceByLabel("Pontos");
        energy = player.GetPlaceByLabel("Energy");

        pontos.AddCallback(RefreshTextos, "refreshPontos", Tokens.In);
        energy.AddCallback(RefreshTextos, "refreshEnergy", Tokens.InOrOut);

        player.GetPlaceByLabel("Win!").AddCallback(Message, "a", Tokens.In);
        player.GetPlaceByLabel("GameOver").AddCallback(Message, "b", Tokens.In);

        winText.text = "";

        RefreshTextos();

        (portal = GameObject.Find("Portal")).SetActive(false);
        (boss = GameObject.Find("BossEnemy")).SetActive(false);
        (boss2 = GameObject.Find("BossEnemy2")).SetActive(false);

        StartCoroutine("EnergyDecrement");
    }