コード例 #1
0
    /// <summary>
    /// Use of WorkSpace
    /// </summary>
    /// <param name="pController"></param>
    public void Interact(PlayerController pController)
    {
        GrabableObject objectInHand = pController.pDatas.objectInHand;

        // Put object = No object in workspace and object in hand of player
        if (haveAnObject == false && objectInHand != null)
        {
            grabableReceived = objectInHand;
            PutObject(pController);
            photonView.RPC("PutObjectInPost", RpcTarget.Others, pController.photonView.OwnerActorNr);
        }
        else if (objectInHand == null && haveAnObject) // Take object = object in workSpace and no object in hand of player
        {
            GeneralError.ErrorNoOutfit(pController);
        }
        else if (objectInHand != null && haveAnObject == true)// put object impossible = object in workspace and object in hand of player
        {
            GameManager.Instance.PopUp.CreateText("Il y a actuellement un objet sur le poste", 50, new Vector2(0, 300), 3.0f);
        }
    }
コード例 #2
0
    /// <summary>
    /// Use of Disinfection Post
    /// </summary>
    /// <param name="pController"></param>
    public void Interact(PlayerController pController)
    {
        player = pController;
        GrabableObject objectInHand = player.pDatas.objectInHand;
        Gastro         gastroInHand = player.pDatas.gastroInHand;

        // Put object = No object on post and object in hand of player
        if (haveAnObject == false && objectInHand != null)
        {
            if (grabableReceived == null)
            {
                Aliment actualAliment;
                if (gastroInHand != null)
                {
                    actualAliment = gastroInHand.alimentStocked;
                }
                else
                {
                    actualAliment = objectInHand.GetComponent <Aliment>();
                }
                if (actualAliment != null && actualAliment.alimentState == AlimentState.InContent)
                {
                    if (player.pDatas.gastroInHand != null)
                    {
                        grabableReceived = player.pDatas.gastroInHand.ReleaseObject(false, false, false);
                    }
                    else
                    {
                        grabableReceived = player.pInteract.ReleaseObject(false, false, false);
                    }
                    grabableReceived.AllowGrab(false);
                    grabableReceived.transform.position = initPos.position;
                    grabableReceived.transform.rotation = initPos.rotation;

                    haveAnObject = true;

                    Aliment newAliment = grabableReceived.GetComponent <Aliment>();

                    // Affect the player
                    player.TeleportTo(playerPosition, true);
                    player.BeginInteractionState();

                    // transform dirty aliment into fresh aliment
                    if (newAliment != null)
                    {
                        GeneralError.ErrorNoOutfit(pController);
                        currentStartAction = StartCoroutine(StartAction(newAliment, transformationTime, true, true));
                    }

                    photonView.RPC("PutObjectInPost", RpcTarget.Others, pController.photonView.OwnerActorNr);
                }
                else
                {
                    GameManager.Instance.PopUp.CreateText("Cet object ne peut pas être déposé ici", 50, new Vector2(0, 300), 3.0f);
                }
            }
        }
        else if (objectInHand != null && haveAnObject == true)
        {
            GameManager.Instance.PopUp.CreateText("Il y a actuellement un objet sur le poste", 50, new Vector2(0, 300), 3.0f);
        }
    }
コード例 #3
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);
            }
        }
    }
コード例 #4
0
    public void Interact(PlayerController pController)
    {
        player = pController;
        GrabableObject objectInHand = player.pDatas.objectInHand;
        Gastro         gastroInHand = pController.pDatas.gastroInHand;

        // Put object = No object on post and object in hand of player
        if (haveAnObject == false && objectInHand != null)
        {
            if (gastroInHand == null)
            {
                if (grabableReceived == null)
                {
                    Aliment actualAliment = objectInHand.GetComponent <Aliment>();
                    string  alimentType   = actualAliment.alimentType.ToString();
                    string  postType      = typeOfTreament.ToString();

                    if (alimentType == postType)
                    {
                        sameState = true;
                    }
                    else
                    {
                        sameState = false;
                    }

                    Debug.Log(alimentType);
                    Debug.Log(postType);
                    Debug.Log(sameState);

                    if (actualAliment != null && (actualAliment.alimentState == AlimentState.InContent || actualAliment.alimentState == AlimentState.Standard))
                    {
                        AlimentObject actualAlimentObject = FoodDatabase.mapAlimentObject[actualAliment.alimentName];

                        bool alimenStateExist = false;
                        for (int i = 0; i < actualAlimentObject.listState.Count; i++)
                        {
                            if (actualAlimentObject.listState[i].state == AlimentState.Clean)
                            {
                                alimenStateExist = true;
                                break;
                            }
                        }

                        if (sameState && alimenStateExist)
                        {
                            grabableReceived = player.pInteract.ReleaseObject(false, false, false);
                            grabableReceived.AllowGrab(false);
                            grabableReceived.AllowPhysic(false);
                            grabableReceived.transform.position = initPos.position;
                            grabableReceived.transform.rotation = initPos.rotation;

                            haveAnObject = true;

                            Aliment newAliment = grabableReceived.GetComponent <Aliment>();

                            // Affect the player
                            player.TeleportTo(playerPosition, true);
                            player.BeginInteractionState();

                            // transform dirty aliment into fresh aliment
                            if (newAliment != null)
                            {
                                GeneralError.ErrorNoOutfit(pController);
                                currentStartAction = StartCoroutine(StartAction(newAliment, transformationTime, true, true));
                            }

                            photonView.RPC("PutObjectInPost", RpcTarget.Others, pController.photonView.OwnerActorNr);
                        }
                        else
                        {
                            GameManager.Instance.PopUp.CreateText("Cet Objet ne peut pas être déposé ici", 50, new Vector2(0, 300), 3.0f);
                        }
                    }
                    else if (objectInHand != null && haveAnObject == true)
                    {
                        GameManager.Instance.PopUp.CreateText("Il y a actuellement un objet sur le poste", 50, new Vector2(0, 300), 3.0f);
                    }
                    else
                    {
                        GameManager.Instance.PopUp.CreateText("Cet Objet ne peut pas être déposé ici", 50, new Vector2(0, 300), 3.0f);
                    }
                }
            }
            else
            {
                GameManager.Instance.PopUp.CreateText("Il n'est pas possible d'utiliser un gastro ici", 50, new Vector2(0, 300), 3.0f);
            }
        }
        else
        {
            GameManager.Instance.PopUp.CreateText("Cet object ne peut pas être déposé ici", 50, new Vector2(0, 300), 3.0f);
        }
    }
コード例 #5
0
    /// <summary>
    /// Use of Disinfection Post
    /// </summary>
    /// <param name="pController"></param>
    public void Interact(PlayerController pController)
    {
        player = pController;
        GrabableObject objectInHand = player.pDatas.objectInHand;
        Gastro         gastroInHand = player.pDatas.gastroInHand;

        // Put object = No object in furnace and object in hand of player
        if (haveAnObject == false && objectInHand != null)
        {
            if (grabableReceived == null)
            {
                Aliment actualAliment;
                if (gastroInHand != null)
                {
                    actualAliment = gastroInHand.alimentStocked;
                }
                else
                {
                    actualAliment = objectInHand.GetComponent <Aliment>();
                }
                if (actualAliment != null && (actualAliment.alimentState == AlimentState.Standard || actualAliment.alimentState == AlimentState.Clean))
                {
                    AlimentObject actualAlimentObject = FoodDatabase.mapAlimentObject[actualAliment.alimentName];

                    bool alimenStateExist = false;

                    for (int i = 0; i < actualAlimentObject.listState.Count; i++)
                    {
                        if (actualAlimentObject.listState[i].state == AlimentState.Cut)
                        {
                            alimenStateExist = true;
                            break;
                        }
                    }
                    if (alimenStateExist)
                    {
                        if (player.pDatas.gastroInHand != null)
                        {
                            grabableReceived = player.pDatas.gastroInHand.ReleaseObject(false, false, false);
                        }
                        else
                        {
                            grabableReceived = player.pInteract.ReleaseObject(false, false, false);
                        }
                        grabableReceived.AllowGrab(false);
                        grabableReceived.transform.position = foodPos.position;
                        grabableReceived.transform.rotation = foodPos.rotation;

                        haveAnObject = true;

                        Aliment newAliment = grabableReceived.GetComponent <Aliment>();

                        // Affect the player
                        player.TeleportTo(playerPosition, true);
                        player.BeginInteractionState();

                        // transform dirty aliment into fresh aliment
                        if (newAliment != null)
                        {
                            GeneralError.ErrorNoOutfit(pController);
                            currentStartAction = StartCoroutine(StartAction(newAliment, transformationTime, true, true));
                        }

                        photonView.RPC("PutObjectInPost", RpcTarget.Others, pController.photonView.OwnerActorNr);
                    }
                    else
                    {
                        GameManager.Instance.PopUp.CreateText("Cet aliment ne peut pas être coupé", 50, new Vector2(0, 300), 3.0f);
                    }
                }
                else
                {
                    GameManager.Instance.PopUp.CreateText("Cet object ne peut pas être déposé ici", 50, new Vector2(0, 300), 3.0f);
                }
            }
        }
        else if (objectInHand == null && haveAnObject == true)  // Take object = object in furnace and no object in hand of player
        {
            if (player.pDatas.gastroInHand != null)
            {
                if (player.pDatas.gastroInHand.StockAliment(objectCutted, true) == false)
                {
                    GameManager.Instance.PopUp.CreateText("impossible de mettre " + objectCutted.GetComponent <Aliment>().alimentName + " dans le gastro", 50, new Vector2(0, 300), 3.0f);
                }
            }
            else
            {
                if (player.pInteract.GrabObject(objectCutted, true) == false)
                {
                    GameManager.Instance.PopUp.CreateText("impossible de prendre " + objectCutted.GetComponent <Aliment>().alimentName + " dans vos mains", 50, new Vector2(0, 300), 3.0f);
                }
            }
        }
        else if (objectInHand != null && haveAnObject == true) // put object impossible = object in furnace and object in hand of player
        {
            GameManager.Instance.PopUp.CreateText("Il y a actuellement un objet sur le poste", 50, new Vector2(0, 300), 3.0f);
        }
    }