void CleanObject(Aliment _aliment, bool instantiateViewID)
    {
        // instantiation of empty aliment (bag, canned food)
        GameObject newEmptyAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.EmptyContent), instantiateViewID).gameObject;

        newEmptyAlimentObject.transform.position = initPos.position;
        newEmptyAlimentObject.transform.rotation = initPos.rotation;

        ObjectEmpty = newEmptyAlimentObject.GetComponent <GrabableObject>();

        ObjectEmpty.Init();

        ObjectEmpty.AllowPhysic(false);
        ObjectEmpty.AllowGrab(true); // To do : change to false
        ObjectEmpty.onGrab += RemoveObject;


        // instantiation of standard aliment (bag, canned food)
        GameObject newStandardAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.Standard), instantiateViewID).gameObject;

        newStandardAlimentObject.transform.position = FinalPos.position;
        newStandardAlimentObject.transform.rotation = FinalPos.rotation;

        ObjectStandard = newStandardAlimentObject.GetComponent <GrabableObject>();

        ObjectStandard.Init();

        Aliment alimentStandard = ObjectStandard.GetComponent <Aliment>();

        if (alimentStandard.alimentType == AlimentType.Vegetable || alimentStandard.alimentType == AlimentType.Meat || alimentStandard.alimentType == AlimentType.Fish)
        {
            alimentStandard.alimentStepState = AlimentStepState.Deconditionning;
        }
        else
        {
            alimentStandard.alimentStepState = AlimentStepState.Treated;
        }


        ObjectStandard.AllowPhysic(false);
        ObjectStandard.AllowGrab(true);
        ObjectStandard.onGrab += RemoveObject;

        grabableReceived.AllowGrab(true);
        grabableReceived.gameObject.GetComponent <Poolable>().DelObject();
        grabableReceived = null;



        if (player.photonView.IsMine)
        {
            // Affect the player
            player.EndInteractionState(this);
            GameManager.Instance.PopUp.CreateText("Objet nettoyé", 50, new Vector2(0, 300), 3.0f);
        }
    }
Ejemplo n.º 2
0
    // transform box into crate
    public void UnpackObject(Aliment _aliment, bool instantiateViewID)
    {
        // instantiation of empty aliment (bag, canned food)
        GameObject newEmptyBoxAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.EmptyBox), instantiateViewID).gameObject;

        newEmptyBoxAlimentObject.transform.position = initPos.position;
        newEmptyBoxAlimentObject.transform.rotation = initPos.rotation;

        ObjectEmpty = newEmptyBoxAlimentObject.GetComponent <GrabableObject>();

        ObjectEmpty.Init();

        ObjectEmpty.AllowPhysic(false);
        ObjectEmpty.AllowGrab(true); // To do : change to false
        ObjectEmpty.onGrab += RemoveObject;


        // instantiation of standard aliment (bag, canned food)
        GameObject newStackAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.Stack), instantiateViewID).gameObject;

        newStackAlimentObject.transform.position = FinalPos.position;
        newStackAlimentObject.transform.rotation = FinalPos.rotation;

        ObjectStack = newStackAlimentObject.GetComponent <GrabableObject>();

        ObjectStack.Init();

        //Aliment alimentStandard = ObjectStack.GetComponent<Aliment>();



        ObjectStack.AllowPhysic(false);
        ObjectStack.AllowGrab(true);
        ObjectStack.onGrab += RemoveObject;

        grabableReceived.AllowGrab(true);
        grabableReceived.gameObject.GetComponent <Poolable>().DelObject();
        grabableReceived = null;



        if (player.photonView.IsMine)
        {
            // Affect the player
            player.EndInteractionState(this);
            GameManager.Instance.PopUp.CreateText("Carton déballé", 50, new Vector2(0, 300), 3.0f);
        }

        player = null;
    }
Ejemplo n.º 3
0
    void CutObject(Aliment _aliment, bool instantiateViewID)
    {
        // instantiation of standard aliment (bag, canned food)
        GameObject newCookedAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.Cut), instantiateViewID).gameObject;

        objectCutted = newCookedAlimentObject.GetComponent <GrabableObject>();

        objectCutted.Init();

        Aliment alimentCooked = objectCutted.GetComponent <Aliment>();

        alimentCooked.alimentStepState = _aliment.alimentStepState;

        objectCutted.AllowPhysic(false);
        objectCutted.AllowGrab(true);
        objectCutted.transform.position = foodPos.position;
        objectCutted.transform.rotation = foodPos.rotation;
        objectCutted.onGrab            += RemoveObject;

        grabableReceived.AllowGrab(true);
        grabableReceived.gameObject.GetComponent <Poolable>().DelObject();
        grabableReceived = null;


        if (player.photonView.IsMine)
        {
            // Affect the player
            player.EndInteractionState(this);
            GameManager.Instance.PopUp.CreateText("Objet coupé", 50, new Vector2(0, 300), 3.0f);
        }
    }
Ejemplo n.º 4
0
    public void PutObjectInColdRoom(int actorNumber)
    {
        PlayerController ownerPlayer = InGamePhotonManager.Instance.PlayersConnected[actorNumber];
        Aliment          foodToAdd   = ownerPlayer.pDatas.objectInHand.GetComponent <Aliment>();

        if (foodToAdd.alimentState == AlimentState.Stack || foodToAdd.alimentState == AlimentState.Box)         // unlimited Food
        {
            if (!foodsStocked.Contains(foodToAdd.CreateKeyPairValue()))
            {
                AddFood(foodToAdd.CreateKeyPairValue(), false);
                ownerPlayer.pInteract.ReleaseObject(false);

                foodToAdd.GetComponent <Poolable>().DelObject();                // !!! chose : put food in pool (or put it on shelf)
            }
            else
            {
                ownerPlayer.pInteract.ReleaseObject(false);
                foodToAdd.GetComponent <Poolable>().DelObject();                // !!! chose : put food in pool (or put it on shelf)
            }
        }
        else                                                                      // limited food
        {
            if (!limitedFoodsStocked.ContainsKey(foodToAdd.CreateKeyPairValue())) //first deposit
            {
                AddFood(foodToAdd.CreateKeyPairValue(), false);
                ownerPlayer.pInteract.ReleaseObject(false);

                foodToAdd.GetComponent <Poolable>().DelObject();                // !!! chose : put food in pool (or put it on shelf)
            }
            else
            {
                limitedFoodsStocked[foodToAdd.CreateKeyPairValue()] += 1;
                ownerPlayer.pInteract.ReleaseObject(false);
                foodToAdd.GetComponent <Poolable>().DelObject();                // !!! chose : put food in pool (or put it on shelf)
            }
        }
    }
Ejemplo n.º 5
0
    public void DisplaySpriteFood(Aliment _aliment, bool _state)
    {
        KeyValuePair <string, AlimentState> keyFood = _aliment.CreateKeyPairValue();
        Sprite foodSprite = FoodDatabase.mapSpriteAliment[keyFood];

        if (foodSprite == null)
        {
            Debug.LogError("Sprite for button not found");
        }
        else
        {
            foodImage.sprite = foodSprite;
        }
        foodImage.gameObject.SetActive(_state);
    }
Ejemplo n.º 6
0
    void CookObject(Aliment _aliment, bool instantiateViewID)
    {
        // instantiation of standard aliment (bag, canned food)
        GameObject newCookedAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.Cooked), instantiateViewID).gameObject;

        objectCooked = newCookedAlimentObject.GetComponent <GrabableObject>();

        objectCooked.Init();

        Aliment alimentCooked = objectCooked.GetComponent <Aliment>();

        alimentCooked.alimentStepState = _aliment.alimentStepState;

        objectCooked.AllowPhysic(false);
        objectCooked.AllowGrab(true);
        objectCooked.transform.position = foodPos.position;
        objectCooked.transform.rotation = foodPos.rotation;
        objectCooked.onGrab            += RemoveObject;

        grabableReceived.AllowGrab(true);
        grabableReceived.gameObject.GetComponent <Poolable>().DelObject();
        grabableReceived = null;
    }
Ejemplo n.º 7
0
    // transform box into crate
    public void TakeSample(Aliment _aliment, bool instantiateViewID)
    {
        objectCooked = grabableReceived;

        objectCooked.AllowPhysic(false);
        objectCooked.AllowGrab(true); // To do : change to false
        objectCooked.onGrab += RemoveObject;


        // instantiation of sample aliment (bag, canned food)
        GameObject newSampleAlimentObject = PoolManager.Instance.Get(_aliment.CreateKeyPairValue(_aliment.alimentName, AlimentState.Sample), instantiateViewID).gameObject;

        newSampleAlimentObject.transform.position = FinalPos.position;
        newSampleAlimentObject.transform.rotation = FinalPos.rotation;

        objectSample = newSampleAlimentObject.GetComponent <GrabableObject>();

        objectSample.Init();

        //Aliment alimentStandard = objectSample.GetComponent<Aliment>();

        objectSample.AllowPhysic(false);
        objectSample.AllowGrab(true);
        objectSample.onGrab += RemoveObject;

        grabableReceived = null;

        if (player.photonView.IsMine)
        {
            // Affect the player
            player.EndInteractionState(this);
            GameManager.Instance.PopUp.CreateText("Echantillon prélevé", 50, new Vector2(0, 300), 3.0f);
        }

        player = null;
    }
Ejemplo n.º 8
0
    //Set Player who use ColdRoom
    public void Interact(PlayerController pController)
    {
        gameManager.FreeMouse();

        player = pController;

        if (player.pDatas.objectInHand == null)
        {
            ui.DisplayUiMenu(); // Display Menu
        }
        else                    // put object in coldRoom
        {
            Gastro gastroInHand = pController.pDatas.gastroInHand;

            if (gastroInHand == null)
            {
                Aliment   foodToAdd = player.pDatas.objectInHand.GetComponent <Aliment>();
                Nominator nominator = player.pDatas.objectInHand.GetComponent <Nominator>();

                if (foodToAdd == null)                 // EXIT IF NO ALIMENT FOUND
                {
                    GameManager.Instance.PopUp.CreateText("Imossible de placer " + nominator.customName + " dans la chambre froide", 50, new Vector2(0, 300), 3.0f);
                    return;
                }

                photonView.RPC("PutObjectInColdRoom", RpcTarget.Others, player.photonView.OwnerActorNr);

                if ((foodToAdd.alimentState == AlimentState.Stack || foodToAdd.alimentState == AlimentState.Box))                 // unlimited Food
                {
                    if (!foodsStocked.Contains(foodToAdd.CreateKeyPairValue()))
                    {
                        AddFood(foodToAdd.CreateKeyPairValue(), true);
                        player.pInteract.ReleaseObject(true, true, false);
                        foodToAdd.GetComponent <Poolable>().DelObject();                        // !!! chose : put food in pool (or put it on shelf)
                        GeneralError.ErrorNoOutfit(pController);
                        GameManager.Instance.PopUp.CreateText(nominator.customName + " déposé", 50, new Vector2(0, 300), 3.0f);
                    }
                    else
                    {
                        player.pInteract.ReleaseObject(true, true, false);
                        foodToAdd.GetComponent <Poolable>().DelObject();                        // !!! chose : put food in pool (or put it on shelf)
                        GeneralError.ErrorNoOutfit(pController);
                        GameManager.Instance.PopUp.CreateText(nominator.customName + " déposé", 50, new Vector2(0, 300), 3.0f);
                    }
                }
                else                                                                      // limited food
                {
                    if (!limitedFoodsStocked.ContainsKey(foodToAdd.CreateKeyPairValue())) //first deposit
                    {
                        AddFood(foodToAdd.CreateKeyPairValue(), true);
                        player.pInteract.ReleaseObject(true, true, false);
                        foodToAdd.GetComponent <Poolable>().DelObject();                        // !!! chose : put food in pool (or put it on shelf)
                        GeneralError.ErrorNoOutfit(pController);
                        GameManager.Instance.PopUp.CreateText(nominator.customName + " déposé", 50, new Vector2(0, 300), 3.0f);
                    }
                    else
                    {
                        limitedFoodsStocked[foodToAdd.CreateKeyPairValue()] += 1;
                        player.pInteract.ReleaseObject(true, true, false);
                        foodToAdd.GetComponent <Poolable>().DelObject();                        // !!! chose : put food in pool (or put it on shelf)
                        GeneralError.ErrorNoOutfit(pController);
                        GameManager.Instance.PopUp.CreateText(nominator.customName + " déposé", 50, new Vector2(0, 300), 3.0f);
                    }
                }
            }
            else
            {
                GameManager.Instance.PopUp.CreateText("Il n'est pas possible de déposer/utiliser un gastro ici", 50, new Vector2(0, 300), 3.0f);
            }
        }
    }