示例#1
0
    private void Update()
    {
        if (playerMovement.busyWith != null && RegisteredEvent == false)
        {
            //Getting the Object the Player's busy with
            UnityEngine.GameObject eventObject = playerMovement.busyWith;

            //Getting the events from the object
            CustomEvent  interactionEvent = eventObject.GetComponent <CustomEvent>();
            InteractItem itemEvent        = eventObject.GetComponent <InteractItem>();

            if (null != interactionEvent)
            {
                RegisteredEvent = true;
                GlobalSaveManager.RegisterEvent(new CustomSaveEvent(SaveEventType.INTERACTION, eventObject, SceneManager.GetActiveScene().buildIndex));
            }
            else if (null != itemEvent)
            {
                RegisteredEvent = true;
                GlobalSaveManager.RegisterEvent(new CustomSaveEvent(SaveEventType.ITEM, eventObject, SceneManager.GetActiveScene().buildIndex));
                GlobalSaveManager.Save();
            }
        }
        else if (playerMovement.busyWith == null)
        {
            RegisteredEvent = false;
        }
    }
示例#2
0
    public void InteractWithItem(InteractItem interactItem)
    {
        if (!IsDemandItemOwned(interactItem.demandItem)) // required demand item item is now owned
        {
            return;
        }

        playerSoundManager.PlayClip(SoundName.Pickup);

        switch (interactItem.category)
        {
        case ItemCategory.OLTAR:
            InteractWithOltar(interactItem.objectName);
            break;

        case ItemCategory.PICKABLE:
            PickItem(interactItem.objectName);
            break;

        case ItemCategory.ENABLER:
            EnableItem(interactItem.objectName);
            break;
        }

        messageManager.hideMessage(); // remove info about interaction when interaction is over
    }
        // Use this for initialization
        public override void Start()
        {
            SituationName   = GlobalTrainingString.oilSpill;
            currentState    = eTrainingState.OilSpill;
            SequencingItems = new eItems[] { eItems.FireAlert, eItems.Rod, eItems.MusterPoint };
            ManagerInteractItems.Instance.ActivateNextObject(SequencingItems[0]);

            InteractItem _item = ManagerInteractItems.Instance.GetItem(eItems.Rod);

            _item.GetComponent <RodItem>().ActivateSituation();
        }
    /// <summary>Returns message for locked items</summary>
    public void displayMessage(InteractItem interactItem)
    {
        this.gameObject.SetActive(true);

        string textToDisplay = "";

        textToDisplay  = interactItem.title;               // first row is title of object
        textToDisplay += addSecondRowDetail(interactItem); // in second are addition instructions

        message.text = textToDisplay;
    }
        // Use this for initialization
        public override void Start()
        {
            SituationName   = GlobalTrainingString.evacuation;
            currentState    = eTrainingState.Evacuation;
            SequencingItems = new eItems[] { eItems.GasMask, eItems.EmergencyEvacuation };
            ManagerInteractItems.Instance.ActivateNextObject(SequencingItems[0]);

            InteractItem  _item  = ManagerInteractItems.Instance.GetItem(eItems.FireAlert);
            FireAlertItem _alert = _item.GetComponent <FireAlertItem>();

            _alert.LightAlert.SetActive(true);
        }
示例#6
0
        // Use this for initialization
        public override void Start()
        {
            SituationName   = GlobalTrainingString.fire;
            currentState    = eTrainingState.Fire;
            SequencingItems = new eItems[] { eItems.FireAlert, eItems.Extinguisher, eItems.Fire, eItems.MusterPoint };
            ManagerInteractItems.Instance.ActivateNextObject(SequencingItems[0]);

            InteractItem _item = ManagerInteractItems.Instance.GetItem(eItems.Fire);
            FireItem     _fire = _item.GetComponent <FireItem>();

            _fire.gameObject.SetActive(true);
        }
    private void touchingObject(GameObject objectInRange)
    {
        itemInRange = itemManager.GetItem(objectInRange.name);

        if (itemInRange != null) // item can be interacted with
        {
            messagePanel.displayMessage(itemInRange);
        }
        else
        {
            messagePanel.hideMessage();
        }
    }
示例#8
0
        private void Receive(string data)
        {
            try
            {
                string[] vars   = data.Split('|');
                int      opcode = int.Parse(vars[0]);

                ClientPacket receivePacket = null;

                switch (opcode)
                {
                case 1: receivePacket = new AuthenticateUserTicket(); break;

                case 2: receivePacket = new UserJoinRoom(); break;

                case 3: receivePacket = new UserClickTile(); break;

                case 4: receivePacket = new UserPendingPlayers(); break;

                case 5: receivePacket = new InteractItem(); break;

                case 6: receivePacket = new RequestNavigatorRoom(); break;

                case 7: receivePacket = new ComposeInventoryRequest(); break;

                case 8: receivePacket = new InventoryPoseItem(); break;

                case 9: receivePacket = new InventoryPoseItemOnTile(); break;

                case 10: receivePacket = new PickItem(); break;
                }

                if (receivePacket != null)
                {
                    receivePacket.Client = this;
                    receivePacket.data   = vars;
                    new Thread(receivePacket.ExecuteAllThePacket).Start();
                }
                else if (ConfigManager.GetBool("connection.missing.packet"))
                {
                    Logger.Warn($"Received unknown packet. [{data}]");
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error received data from GC => " + e.ToString());
            }
        }
    private string addSecondRowDetail(InteractItem interactItem)
    {
        string textToReturn = "";

        if (interactItem.category == ItemCategory.READABLE)
        {
            textToReturn += Constants.textSuffixes.READ;                                                            // item to read
        }
        else if (!inventory.IsDemandItemOwned(interactItem.demandItem) || interactItem.state == ItemState.DISABLED) // cant interact because item is not owned or item is disabled
        {
            textToReturn += textMessageManager.getDisabledMessage(interactItem.objectName);
        }
        else if (interactItem.state == ItemState.ENABLED) // item can be interacted with
        {
            textToReturn += textMessageManager.getEnabledMessage(interactItem.objectName);
        }

        return(System.Environment.NewLine + textToReturn);
    }
示例#10
0
 private void notTouchingAnyObject()
 {
     itemInRange = null;
     messagePanel.hideMessage();
 }
示例#11
0
 void Start()
 {
     _interactArea = gameObject.GetComponentInChildren <InteractItem>();
 }