Exemplo n.º 1
0
 public virtual void Interact(InteractionManager manager, Vector2 position, InteractType type)
 {
     if (type == InteractType.RClickPress)
     {
         LevelManager.RemoveTile(this.Position);
     }
 }
Exemplo n.º 2
0
    public void OnInteract(CustomObject obj, InteractType type)
    {
        if (m_targetScene == null) return;
        if (defaultStatus < 2) return;
        if (type == InteractType.Stay)
        {

          PlanerCore x = obj as PlanerCore;
          if (x != null&&x.State==0)
          {
          if (defaultStatus == 2)
            defaultStatus = 1;

          if (object.ReferenceEquals(x, Creator.Player))
          {
            PlayerSaveData.SaveDiscoveredScene(m_targetScene, defaultStatus);
            x.AddUpdateFunc(OnPlanerEnter);
            x.HasTarget = true;
          }
          else
          {
            Creator.DestroyObject(x);
          }
          }
        }
    }
Exemplo n.º 3
0
    public void Interact(InteractType type)
    {
        switch (type)
        {
        case InteractType.LookAt:
            if (!Flags.Instance.IsFlagSet(Flags.FlagNames.HasCheese))
            {
                GameLog.Instance.Log(data.lookAtMsgs.GetNext());
            }
            else
            {
                GameLog.Instance.Log("The fridge is empty");
            }
            break;

        case InteractType.PickUp:
            GameLog.Instance.Log(data.pickUpMsg.GetNext());
            break;

        case InteractType.Use:
            HandleUse();
            break;
        }
        SaveManager.Instance.Save(saveKey, data);
    }
Exemplo n.º 4
0
    public void Interact(IUnit unit, InteractType interactType)
    {
        if (!interact)
        {
            return;
        }
        switch (interactType)
        {
        case InteractType.GIVE:
            _buildingInfo.Give(unit);
            break;

        case InteractType.TAKE:
            _buildingInfo.Take(unit);
            if (_buildingInfo.IsBroken())
            {
                Destroy(gameObject);
            }
            break;

        default:
            break;
        }
        UpdateText();
    }
    private void Start()
    {
        _clickHp = Mathf.RoundToInt(Random.Range(0.5f, 1f) * (Gamemanager.Instance.DifficultyLevel - 1) * 4 + 1);
        _clickHp = 1;

        if (this.InteractionType == InteractType.Random)
        {
            bool click = Random.Range(0f, 1f) > 0.3f;
            if (click)
            {
                this.InteractionType = InteractType.Click;
            }
            else
            {
                InteractionType = InteractType.DragToCircle;
            }
        }

        switch (InteractionType)
        {
        case InteractType.Click:

            break;

        case InteractType.DragToCircle:

            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
    }
Exemplo n.º 6
0
 public override void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("Entry", Entry.ToString());
     writer.WriteAttributeString("InteractDelay", InteractDelay.ToString());
     writer.WriteAttributeString("InteractType", InteractType.ToString());
     writer.WriteAttributeString("GameObjectType", GameObjectType.ToString());
     writer.WriteAttributeString("SpellFocus", SpellFocus.ToString());
 }
        public static void AddNewInteractable(InteractType type, Dictionary<string, string> args)
        {
            args["type"] = type.ToString();
            args["x"] = XLoc.ToString();
            args["y"] = YLoc.ToString();

            InteractableList.Add(args);
            RefreshInteractableList();
        }
Exemplo n.º 8
0
    private void Interact()
    {
        if (m_CurrInteractable != null)
        {
            InteractType type = m_CurrInteractable.GetType();
            switch (type)
            {
            case InteractType.Bonfire:
                if (m_BranchesCarrying > 0)
                {
                    if (m_CurrInteractable.Interact())
                    {
                        m_BranchesCarrying--;
                    }
                }
                break;

            case InteractType.Tree:
                if (m_BranchesCarrying < m_MaxBranchesCarrying)
                {
                    if (m_CurrInteractable.Interact())
                    {
                        m_BranchesCarrying++;
                    }
                }
                break;

            case InteractType.River:
                if (m_IsCarryingBucket)
                {
                    if (m_CurrInteractable.Interact())
                    {
                        m_WaterCarrying += 0.1f;
                    }
                }
                break;

            case InteractType.Invalid:
                break;

            default:
                break;
            }
        }
        else
        {
            if (m_IsCarryingBucket)
            {
            }
            //TODO - Drop Bucket
            else if (m_BranchesCarrying > 0)
            {
                m_BranchesCarrying = 0;
            }
        }
    }
Exemplo n.º 9
0
    public void OnInteract(CustomObject obj, InteractType type)
    {
        DistantPortalEnter x = obj as DistantPortalEnter;
        if (x != null)
        {

          if(x.defaultStatus<1)
        x.Status = 1;
        }
    }
Exemplo n.º 10
0
        public ClientInteractNetworkedObjectRequestPayload([NotNull] NetworkEntityGuid targetObjectGuid, InteractType interactionType)
        {
            if (!Enum.IsDefined(typeof(InteractType), interactionType))
            {
                throw new InvalidEnumArgumentException(nameof(interactionType), (int)interactionType, typeof(InteractType));
            }

            TargetObjectGuid = targetObjectGuid ?? throw new ArgumentNullException(nameof(targetObjectGuid));
            InteractionType  = interactionType;
        }
Exemplo n.º 11
0
    [ClientRpc] void RpcStartInteract(GameObject interactableObj)
    {
        Interactable interactable = interactableObj.GetComponent <Interactable>();

        if (interactable.CanInteract())
        {
            interactingType   = interactable.Interact(hero);
            interactingObject = interactable;
            isInteracting     = true;
        }
    }
Exemplo n.º 12
0
    void CheckInteract()
    {
        Transform  camTransform = Camera.main.transform;
        Vector3    camEuler     = camTransform.eulerAngles;
        Quaternion rotation     = Quaternion.AngleAxis(camEuler.y, Vector3.up);
        Ray        camRay       = new Ray(camTransform.position, rotation * Vector3.forward);
        RaycastHit hit;

        isInteracting = false;
        // Fire ray out from camera
        if (Physics.Raycast(camRay, out hit, 1000f, hitLayers, QueryTriggerInteraction.Collide))
        {
            isInteracting = true;
            Interactable interactable = hit.collider.GetComponent <Interactable>();
            if (interactable)
            {
                InteractType interactType = interactable.type;
                switch (interactType)
                {
                case InteractType.BUTTON:
                    doorOpen = !doorOpen;
                    break;

                case InteractType.PUSHABLE:
                    interactable.Push(-hit.normal * pushForce, hit.point);
                    break;

                case InteractType.MINIGAME:
                    break;

                case InteractType.DOOR:
                    if (doorOpen)
                    {
                        print("Level Complete! Loading next level...");
                        SceneManager.LoadScene(2);
                    }
                    if (!doorOpen)
                    {
                        print("You need to find a way to open the door. Try the red button");
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                Debug.LogError("There is no 'Interactable' script attached to the thing we hit");
            }
        }
    }
Exemplo n.º 13
0
 void OnInteract(CustomObject obj, InteractType type)
 {
     //Debug.Log("interact");
     if (type == InteractType.Stay)
     {
       PlanerCore planer = obj as PlanerCore;
       if (planer == null) return;
       planer.OnDamageDealt(damage);
       m_visualiser.transform.parent = transform.parent;
       (m_visualiser.GetComponent<BasicMineVisualiser>()).OnDestroyed();
       Creator.DestroyObject(this);
     }
 }
Exemplo n.º 14
0
 void OnInteract(CustomObject obj, InteractType type)
 {
     if (type == InteractType.Enter)
     {
       IPlanerLike planer = obj as IPlanerLike;
       if (planer != null)
       {
     //placed = true;
     planer.AddUpdateFunc(PlanerNewUpdater);
     m_caughtList.Add(planer);
       }
     }
 }
Exemplo n.º 15
0
    public void Interact(InteractType type)
    {
        switch (type)
        {
        case InteractType.LookAt:
            GameLog.Instance.Log(lookAtMsgs.GetNext());
            break;

        case InteractType.PickUp:
            GameLog.Instance.Log(pickUpMsg.GetNext());
            break;
        }
    }
Exemplo n.º 16
0
    void OnInteract(CustomObject obj, InteractType type)
    {
        if (PairPortal == null) return;
        if (type == InteractType.Stay)
        {
          PlanerCore x = obj as PlanerCore;

          if (x != null&&!x.EnteredPortal&&!(x.State==1))
          {
        x.AddUpdateFunc(OnPlanerEnter);
        x.HasTarget = true;
          }
        }
    }
Exemplo n.º 17
0
        void CheckForInteraction()
        {
            RaycastHit hit;
            Ray        newRay = new Ray(transform.position, playerCamera.transform.forward);

            if (Physics.Raycast(newRay, out hit, 500))
            {
                if (hit.transform.gameObject.GetComponent <IInteractable>() != null && hit.transform.gameObject.GetComponent <IInteractable>().canInteract)
                {
                    hitInteractable     = true;
                    currentInteractType = hit.transform.gameObject.GetComponent <IInteractable>().interactType;

                    if (Input.GetButtonDown("Interact"))
                    {
                        unHoverStillPressingECheck = true;
                        startEquipTimeCheck        = true;
                    }
                    else if (Input.GetButtonUp("Interact") && unHoverStillPressingECheck)
                    {
                        hit.transform.GetComponent <IInteractable>().Interact(_playerBase);
                        startEquipTimeCheck = false;
                        pickUpTimer         = 0;
                    }

                    if ((pickUpTimer >= holdDownToEquipTime))
                    {
                        if (hit.transform.gameObject.GetComponent <Item>() != null)
                        {
                            Item item = hit.transform.GetComponent <Item>();
                            QuickEquipItem(item);
                        }
                        startEquipTimeCheck = false;
                    }
                }
                else
                {
                    unHoverStillPressingECheck = false;
                    startEquipTimeCheck        = false;
                    hitInteractable            = false;
                }
            }
            else
            {
                unHoverStillPressingECheck = false;
                startEquipTimeCheck        = false;
                hitInteractable            = false;
            }
        }
Exemplo n.º 18
0
 public void OnInteract(CustomObject obj, InteractType type)
 {
     if(ReferenceEquals(obj, Creator.Player))
     {
       if (IsActive==0)
       {
     Activate();
     //TODO
       }
       else if(IsActive==1)
       {
     Deactivate();
     //TODO
       }
     }
 }
Exemplo n.º 19
0
        public InteractType GetInteractType()
        {
            InteractType result = 0;

            if (this is ICanInspect)
            {
                result |= InteractType.Inspect;
            }

            if (this is ICanBeUsed)
            {
                result |= InteractType.Use;
            }

            return(result);
        }
    public void Interact(InteractType type)
    {
        switch (type)
        {
        case InteractType.LookAt:
            GameLog.Instance.Log(data.lookAtMsg.GetNext());
            break;

        case InteractType.PickUp:
            GameLog.Instance.Log(data.pickUpMsg.GetNext());
            break;

        case InteractType.Use:
            GameLog.Instance.Log(data.useMsg.GetNext());
            break;
        }
        SaveManager.Instance.Save(saveKey, data);
    }
Exemplo n.º 21
0
    public void OnInteract(CustomObject obj, InteractType type)
    {
        if (type == InteractType.Stay) return;

        DistantPortalEnter x = obj as DistantPortalEnter;
        if (x != null)
        {
          if (x.defaultStatus == 0) return;
          if(x.defaultStatus==2)
        x.Status = 3;
          Creator.DestroyObject(this);
        }
        IFireflyDestroyable dest = obj as IFireflyDestroyable;
        if (dest != null&&!obj.Destroyed)
        {
          dest.FireflyDestroy(this);
        }
    }
Exemplo n.º 22
0
    public void GetInteract(InteractType IT)
    {
        switch (IT)
        {
        case InteractType.SHAKE:
            afterSHAKE.Invoke();
            break;

        case InteractType.UP:
            afterUP.Invoke();

            break;

        case InteractType.DOWN:
            afterDOWN.Invoke();

            break;
        }
    }
Exemplo n.º 23
0
    void FindInteractType()
    {
        bool frontDetected = interactDetector.DetectFront(out hitInfo);

        interact = InteractType.None;
        interactHintText.text = "";
        if (state == States.Normal)
        {
            if (frontDetected)
            {
                if (hitInfo.collider.CompareTag("ladder"))
                {
                    interact = InteractType.Ladder;
                    interactHintText.text = "Press [E] to Climb Ladder";
                    return;
                }
                else if (grounded && hitInfo.collider.CompareTag("DialogueTrigger"))
                {
                    interact = InteractType.Dialogue;
                    interactHintText.text = "Press [E] to Talk";
                    return;
                }
                else if (grounded && hitInfo.collider.CompareTag("checkpoint"))
                {
                    interact = InteractType.Checkpoint;
                    interactHintText.text = "Press [E] to Take a Break at Checkpoint";
                    return;
                }
                else if (hitInfo.collider.CompareTag("Item") && !hitInfo.collider.GetComponent <IItem>().IsPickedUp())
                {
                    interact = InteractType.Item;
                    interactHintText.text = hitInfo.collider.GetComponent <IItem>().GetInteractMessage();
                }
            }
        }
        else if (state == States.GrabStable)
        {
            interactHintText.text = "Press [W] to Climb Up\nPress [S] to Drop Down";
        }
    }
Exemplo n.º 24
0
    public ComputerInteractionModel(InteractType type)
    {
        currentActive = false;

        if (type == InteractType.write)
        {
            speed       = 1;
            actionName  = "Write";
            description = "Writing a Novel";
        }
        else if (type == InteractType.art)
        {
            speed       = 1;
            actionName  = "Create Art";
            description = "Creating an Artpiece";
        }
        else if (type == InteractType.compose)
        {
            speed       = 1;
            actionName  = "Create Music";
            description = "Composing a Song";
        }
    }
Exemplo n.º 25
0
    public void reciveMsg(string msg)
    {
        InteractType IT = InteractType.NONE;

        switch (msg)
        {
        case "SHAKEINT":
            IT = InteractType.SHAKE;
            break;

        case "UPINT":
            IT = InteractType.UP;
            break;

        case "DOWNINT":
            IT = InteractType.DOWN;
            break;
        }
        if (interactArea)
        {
            interactArea.GetInteract(IT);
        }
    }
Exemplo n.º 26
0
 public virtual bool CanInteract(InteractionManager manager, Vector2 position, InteractType type)
 {
     return(true);
 }
Exemplo n.º 27
0
 public IInteractable GetInteractableItem(InteractType type = InteractType.Hover)
 {
     return(this.HoveredItems
            .FirstOrDefault(item => item.CanInteract(this, MouseTilePosition, type)));
 }
        public static InteractType GenerateInteractType(Creature_proto proto)
        {
            InteractType type = InteractType.INTERACTTYPE_IDLE_CHAT;

            switch (proto.TitleId)
            {
            case CreatureTitle.RallyMaster:
                type = InteractType.INTERACTTYPE_BINDER;
                break;

            case CreatureTitle.Apothecary:
            case CreatureTitle.Butcher:
            case CreatureTitle.Cultivator:
            case CreatureTitle.Salvager:
            case CreatureTitle.Scavenger:
            case CreatureTitle.HedgeWizard:
            case CreatureTitle.Trainer:
            case CreatureTitle.CareerTrainer:
            case CreatureTitle.RenownTrainer:
            case CreatureTitle.ApprenticeCareerTrainer:
            case CreatureTitle.ApprenticeRenownTrainer:
                type = InteractType.INTERACTTYPE_TRAINER;
                break;

            case CreatureTitle.FlightMaster:
            case CreatureTitle.ExpeditionQuartermaster:
                type = InteractType.INTERACTTYPE_FLIGHT_MASTER;
                break;

            case CreatureTitle.GuildRegistrar:
                type = InteractType.INTERACTTYPE_GUILD_REGISTRAR;
                break;

            case CreatureTitle.Healer:
                type = InteractType.INTERACTTYPE_HEALER;
                break;

            case CreatureTitle.Banker:
                type = InteractType.INTERACTTYPE_BANKER;
                break;

            case CreatureTitle.Auctioneer:
                type = InteractType.INTERACTTYPE_AUCTIONEER;
                break;

            case CreatureTitle.NameRegistrar:
                type = InteractType.INTERACTTYPE_LASTNAMESHOP;
                break;

            case CreatureTitle.VaultKeeper:
                type = InteractType.INTERACTTYPE_GUILD_VAULT;
                break;

            case CreatureTitle.Merchant:
            case CreatureTitle.ArmorMerchant:
            case CreatureTitle.WeaponMerchant:
            case CreatureTitle.CampMerchant:
            case CreatureTitle.SiegeWeaponMerchant:
            case CreatureTitle.CraftSupplyMerchant:
            case CreatureTitle.RenownGearMerchant:
            case CreatureTitle.Quartermaster:
            case CreatureTitle.BasicRenownGearMerchant:
            case CreatureTitle.VeteranRenownGearMerchant:
            case CreatureTitle.AdvancedRenownGearMerchant:
            case CreatureTitle.RecruitMedallionQuartermaster:
            case CreatureTitle.ScoutMedallionQuartermaster:
            case CreatureTitle.SoldierMedallionQuartermaster:
            case CreatureTitle.OfficerMedallionQuartermaster:
            case CreatureTitle.RoyalQuartermaster:
            case CreatureTitle.RecruitEmblemQuartermaster:
            case CreatureTitle.ScoutEmblemQuartermaster:
            case CreatureTitle.SoldierEmblemQuartermaster:
            case CreatureTitle.OfficerEmblemQuartermaster:
            case CreatureTitle.VanquisherQuartermaster:
            case CreatureTitle.VerySpecialDyeVendor:
            case CreatureTitle.SpecializedArmorsmith:
            case CreatureTitle.RenownArmorQuartermaster:
            case CreatureTitle.RenownWeaponQuartermaster:
            case CreatureTitle.CommoditiesQuartermaster:
            case CreatureTitle.TomeTacticLibrarian:
            case CreatureTitle.TomeTrophyLibrarian:
            case CreatureTitle.EliteRenownGearMerchant:
            case CreatureTitle.UpgradeMerchant:
            case CreatureTitle.DoorRepairMerchant:
            case CreatureTitle.StandardMerchant:
            case CreatureTitle.TomeAccessoryLibrarian:
            case CreatureTitle.TomeTokenLibrarian:
            case CreatureTitle.TalismanMerchant:
            case CreatureTitle.MountVendor:
            case CreatureTitle.CompanionKeeper:
            case CreatureTitle.NoveltyVendor:
            case CreatureTitle.Librarian:
            case CreatureTitle.RecordsKeeper:
                type = InteractType.INTERACTTYPE_DYEMERCHANT;
                break;

            case CreatureTitle.LightMountVendor:
            case CreatureTitle.HeavyMountVendor:
            case CreatureTitle.SpecialtyMountWrangler:
                type = InteractType.INTERACTTYPE_STORE;
                break;

            case CreatureTitle.BarberSurgeon:
                type = InteractType.INTERACTTYPE_BARBER_SURGEON;
                break;
            }

            return(type);
        }
Exemplo n.º 29
0
 void OnInteract(CustomObject obj, InteractType type)
 {
     Warming warm = obj as Warming;
       if (warm != null&&!warm.isEaten)
       {
           AddHP();
     warm.isEaten = true;
       }
 }
Exemplo n.º 30
0
 public void OnInteract(CustomObject obj, InteractType type)
 {
     if (type == InteractType.Enter)
     {
       WarmingHole x = obj as WarmingHole;
       if (x != null && !m_ai.HasTarget)
       {
     Creator.DestroyObject(this);
       }
     }
 }
Exemplo n.º 31
0
    public WaitForSeconds Interact(Interactions player)
    {
        //if (collectible)
        //{
        //    thisRigid.isKinematic = true;
        //
        //    //gameObject.AddComponent<FixedJoint>();
        //}

        var held = player.heldObj;

        switch (type)
        {
        case InteractType.Basic:
            if (held)
            {
                var rand = _pool.invalidInteract[Random.Range(0, _invalidLength)];
                source.PlayOneShot(rand);
                print("That doesn't do anything");
                return(_pool.invalidWaits[rand]);
            }
            if (_interacted)
            {
                animator.SetTrigger(-662453572);
                //if (_wait1 == null) _wait1 = new WaitForSeconds(animator.GetCurrentAnimatorClipInfo(0)[0].clip.length);
                _interacted = !_interacted;
                source.PlayOneShot(clip_1);
                print("Playing Clip 1");
                return(_wait1);
            }
            else
            {
                animator.SetTrigger(-662453572);
                //if (_wait2 == null) _wait2 = new WaitForSeconds(animator.GetCurrentAnimatorClipInfo(0)[0].clip.length);
                _interacted = !_interacted;
                source.PlayOneShot(clip_2);
                print("Playing Clip 2");
                return(_wait2);
            }

        case InteractType.Story:

            if (_interacted)
            {
                //undecided what to do here possibly activate expanding bloom like screen whiting out and playing audio.
                //maybe visually show stuff or isolate the interacted object.
            }
            else
            {
                //Secondary story
            }

            break;

        case InteractType.Key:
            if (!held)
            {
                var t = transform;
                t.SetParent(player.holdPos, true);
                t.localPosition       = Vector3.zero;
                thisRigid.isKinematic = true;
                thisCollider.enabled  = false;
                player.heldObj        = this;
                source.PlayOneShot(clip_1);
                print("Playing Clip 1");
                player.DisableInteract();
                return(_wait1);
            }
            else
            {
                var rand = _pool.manyKeys[Random.Range(0, _keysLength)];
                source.PlayOneShot(rand);
                return(_pool.invalidWaits[rand]);
                //transform.SetParent(null, true);
                //thisRigid.isKinematic = false;
                //source.PlayOneShot(clip_2);
                //print("Playing Clip 2");
                //return _wait2;
            }

        case InteractType.Lock:
            if (held != null)
            {
                if (held.type == InteractType.Key && held.target == target)
                {
                    held.gameObject.SetActive(false);
                    player.heldObj = null;
                    type           = InteractType.Basic;
                    var rand = _pool.unlocks[Random.Range(0, _invalidLength)];
                    source.PlayOneShot(rand);
                    animator.SetTrigger(-125993919);
                    print("You unlocked the thing!");
                    return(_pool.unlockWaits[rand]);
                }
                if (held.type == InteractType.Key)
                {
                    var rand = _pool.invalidInteract[Random.Range(0, _lockedLength)];
                    source.PlayOneShot(rand);
                    print("The key doesnt fit");
                    return(_pool.invalidWaits[rand]);
                }
                else
                {
                    var rand = _pool.invalidInteract[Random.Range(0, _lockedLength)];
                    source.PlayOneShot(rand);
                    print("The thing you're holding is bad");
                    return(_pool.invalidWaits[rand]);
                }
            }
            else
            {
                var rand = _pool.targetLocked[Random.Range(0, _invalidLength)];
                source.PlayOneShot(rand);
                animator.SetTrigger(-310456921);
                print("It is locked");
                return(_pool.lockedWaits[rand]);
            }

        case InteractType.Puzzle:

            break;
        }



        return(null);
    }
Exemplo n.º 32
0
 public void SetNPC(NPCController npc)
 {
     npcInRange   = npc;
     interactType = InteractType.SingleNPC;
 }
Exemplo n.º 33
0
 public void RemoveNPC()
 {
     npcInRange   = null;
     interactType = InteractType.None;
 }
Exemplo n.º 34
0
 public InteractComponent(InteractType type)
 {
     Type = type;
 }
Exemplo n.º 35
0
 public void OnInteractEnter(CustomObject obj, InteractType type)
 {
     if (TargetTrigger == null) return;
     if (type == InteractType.Enter) return;
     if (TargetTrigger.IsAssignableFrom(obj.GetType()))
     {
             Activate();
     }
 }
Exemplo n.º 36
0
 public InteractCache(InteractType type, Object interactObject)
 {
     this.type           = type;
     this.interactObject = interactObject;
 }
Exemplo n.º 37
0
 void OnInteract(CustomObject obj, InteractType type)
 {
     if(obj as PlanerCore==null)return;
       gameObject.GetComponent<Anchor>().m_activated=true;
     Creator.creator.Pause();
 }