Esempio n. 1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.GetComponent <PlayerMove>())
     {
         reaction.React();
     }
 }
Esempio n. 2
0
    protected void OnTriggerEnter2D(Collider2D collision)
    {
        // 상호작용이 가능한 거리로 플레이어가 접근
        if (collision.tag == "Player")
        {
            // NPC가 이벤트 수행중이 아니라면, 현재 행동을 멈추고 플레이어를 바라본다.
            // 저장된 UI 리스트에서 UI를 생성 (각 UI 생성 위치는 현재 무시..)
            foreach (var ui in list)
            {
                Debug.Log("NotCondition + " + transform.parent.name);
                // 해당 UI 프리팹을 생성
                Button button = Instantiate(ui, transform.position, transform.rotation);

                // 현재 생성된 UI를 목록에 저장
                conShowedUI.Add(button);

                // 생성한 UI를 Canvas 하위로 이동
                button.transform.SetParent(canvas);

                FSLocator.uiContainer.InsertObservation(button.gameObject);

                // 생성한 UI 위치를 부모 객체 위로 이동
                Vector3 myVector = transform.parent.position;
                button.GetComponent <DynamicUI> ().SetVector(myVector);
                button.onClick.RemoveAllListeners();
                button.onClick.AddListener(delegate {
                    reaction.InitIndex();
                    reaction.React();
                });
            }
        }
    }
    // This is called by the Interactable one at a time for each of its ConditionCollections until one returns true.
    public bool CheckAndReact()
    {
        Debug.Log("CheckAndReact called");
        // Go through all Conditions...
        for (int i = 0; i < requiredConditions.Length; i++)
        {
            // ... and check them against the AllConditions version of the Condition.  If they don't have the same satisfied flag, return false.
//            if (!AllConditions.CheckCondition (requiredConditions[i]))
//                return false;
            if (!requiredConditions[i].evalFunc())
            {
                if (negReactionCollection)
                {
                    negReactionCollection.React();
                }
                return(false);
            }
        }

        Debug.Log("reaction collection is " + reactionCollection);
        // If there is an ReactionCollection assigned, call its React function.
        if (reactionCollection)
        {
            reactionCollection.React();
        }
        else
        {
            Debug.Log("no reaction collection assigned");
        }

        // A Reaction happened so return true.
        return(true);
    }
Esempio n. 4
0
 // This is called when the player arrives at the interactionLocation.
 public void Interact()      //
 {
     if (!ReactionCollection.React())
     {
         defaultReactionCollection.React();
     }
 }
Esempio n. 5
0
    protected void OnTriggerEnter2D(Collider2D collision)
    {
        // 상호작용이 가능한 거리로 플레이어가 접근
        if (collision.tag == "Player")
        {
            // NPC가 이벤트 수행중이 아니라면, 현재 행동을 멈추고 플레이어를 바라본다.
            //parentObject.GetComponent<NpcScript>().NearByPlayer();

            // 저장된 UI 리스트에서 UI를 생성 (각 UI 생성 위치는 현재 무시..)
            foreach (var ui in list)
            {
                // 해당 UI 프리팹을 생성
                Button button = Instantiate(ui, transform.position, transform.rotation);

                // 현재 생성된 UI를 목록에 저장
                conShowedUI.Add(button);

                // 생성한 UI를 Canvas 하위로 이동
                button.transform.SetParent(canvas);

                // 생성한 UI 위치를 부모 객체 위로 이동
                button.GetComponent <RectTransform>().anchoredPosition = new Vector2(parentObject.position.x, parentObject.position.y + 1.8f);

                button.onClick.RemoveAllListeners();
                button.onClick.AddListener(delegate {
                    reaction.InitIndex();
                    reaction.React();
                });
            }
        }
    }
Esempio n. 6
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         print("true");
         reaction.React();
     }
 }
Esempio n. 7
0
 public void Interact()
 {
     for (int i = 0; i < conditionCollections.Length; i++)
     {
         conditionCollections [i].CheckAndReact();
     }
     defaultReactionCollection.React();
 }
Esempio n. 8
0
 public void workStart()
 {
     if (targetTime > 0)
     {
         activated      = true;
         workModifierID = barModifier.addToModifiers(new Modifier("WorkToDo", workIncrement, 0, -2));
         workStartReaction.React();
     }
 }
 public void bathroomUsageStart()
 {
     if (targetTime > 0)
     {
         activated = true;
         bathroomUsageModifierID = barModifier.addToModifiers(new Modifier("bathroomUsage", 0, 0, comfortIncrement));
         bathroomUsageStartReaction.React();
     }
 }
Esempio n. 10
0
    private void DelayReactionStart()
    {
        delayReacitonCollection.InitIndex();
        delayReacitonCollection.React();

        if (wantDestroy != null)
        {
            Destroy(wantDestroy);
        }
    }
Esempio n. 11
0
 // Update is called once per frame
 void Update()
 {
     if (Once)
     {
         Panel.blocksRaycasts = true;
         reaction.React();
         Once = false;
         Panel.blocksRaycasts = false;
         gameObject.SetActive(false);
     }
 }
Esempio n. 12
0
 public void Interact()
 {
     for (int i = 0; i < conditionCollections.Length; i++)
     {
         if (conditionCollections[i].VerifyAndExecute())
         {
             return;
         }
     }
     defaultReactionCollection.React();
 }
Esempio n. 13
0
 public void onLevelStartClick()
 {
     if (levelManager.checkUnlocked())
     {
         startReactionCollection.React();
     }
     else
     {
         LockedReactionCollection.React();
     }
 }
    public void Interact()
    {
        for (var i = 0; i < conditionCollections.Length; i++)
        {
            if (conditionCollections[i].CheckAndReact())
            {
                return;
            }
        }

        defaultReactionCollection.React();
    }
Esempio n. 15
0
 private void timerEnded()
 {
     if (levelManagement.checkLevelObjectivesAchieved())
     {
         timeUpObjectivesAchieved.React();
         levelManagement.unlockNextLevel();
     }
     else
     {
         timeUpObjectivesFailed.React();
     }
 }
Esempio n. 16
0
    public override void Interact()
    {
        base.Interact();
        if (check)
        {
            return;
        }
        base.Interact();
        check = true;
        StartCoroutine("reset");

        if (this.GetComponent <NPCItem>() != null)
        {
            this.GetComponent <NPCItem>().setNPCItem(this.GetComponent <NPCItem>().ntype);
            Debug.Log("set item");
        }

        Debug.Log("interact");
        if (dialogPanel != null)
        {
            dialogPanel.SetActive(true);
            DialogArray da = GetComponent <DialogArray> ();
            DialogPanel dp = dialogPanel.GetComponentInChildren <DialogPanel> ();
            if (dp != null)
            {
                dp.UpdateDialog(da.conversations);
            }
        }



        for (int i = 0; i < conditionCollections.Length; i++)
        {
            if (conditionCollections[i].CheckAndReact())
            {
                Debug.Log("not default");
                //return;
                conditionCollections[i].complete = true;
                QuestListUpdate();
                return;
            }
            //conditionCollections[i].CheckAndReact ();
        }

        QuestListUpdate();
        Debug.Log("default");
        if (defaultReactionCollection != null)
        {
            defaultReactionCollection.React();
        }
        //manager.content = questList.Change();
    }
Esempio n. 17
0
    public void Interact()
    {
        Debug.Log("Interacting in interact");
        for (int i = 0; i < conditionCollections.Length; i++)
        {
            if (conditionCollections[i].CheckAndReact())
            {
                return;
            }
        }

        defaultReactionCollection.React();
    }
Esempio n. 18
0
    public void Work()
    {
        for (int i = 0; i < conditions.Length; i++)
        {
            if (conditions[i].CheckAndReact(this))
            {
                return;
            }
        }

        // No reactions satisfied: Do default
        defaultReaction.React(this);
    }
Esempio n. 19
0
        public void Interact(MonoBehaviour behaviour)
        {
            for (int i = 0; i < conditionCollections.Length; i++)
            {
                if (conditionCollections[i].CheckAndReact(this))
                {
                    return;
                }
            }

            material.SetColor("_SolidOutline", Color.red);
            defaultReactionCollection?.React(behaviour);
        }
    public bool CheckAndReact()
    {
        if (requiredConditions.Any(rc => !AllConditions.CheckCondition(rc)))
        {
            return(false);
        }

        if (reactionCollection)
        {
            reactionCollection.React();
        }

        return(true);
    }
Esempio n. 21
0
        public bool CheckAndReact(MonoBehaviour behaviour)
        {
            for (int i = 0; i < RequiredConditions.Length; i++)
            {
                if (!AllConditions.CheckCondition(RequiredConditions[i]))
                {
                    return(false);
                }
            }

            ReactionCollection?.React(behaviour);

            return(true);
        }
Esempio n. 22
0
 // Player Calls this Function on Arriving At Interactable
 public void Interact()
 {
     // Go through all the ConditionCollections
     for (int i = 0; i < conditionCollections.Length; i++)
     {
         // If React Happens
         if (conditionCollections[i].CheckAndReact())
         {
             // Exit function
             return;
         }
     }
     // Otherwise use the Default Reaction
     defaultReactionCollection.React();
 }
Esempio n. 23
0
    public void InvokeConditionReaction()
    {
        isFirst = false;

        if (!isFirst)
        {
            isFirst = true;

            reactionCollection.InitIndex();
            reactionCollection.React();

            /*if (!FSLocator.controlManager.EventIsPlaying)
             *  ;*/
        }
    }
Esempio n. 24
0
 public bool CheckAndReact()
 {
     for (int i = 0; i < requiredConditions.Length; i++)
     {
         if (!AllConditions.CheckCondition(requiredConditions[i]))
         {
             return(false);
         }
     }
     if (reactionCollection)
     {
         reactionCollection.React();
     }
     return(true);
 }
Esempio n. 25
0
    // This is called when the player arrives at the interactionLocation.
    public void Interact()
    {
        // Go through all the ConditionCollections...
        for (int i = 0; i < conditionCollections.Length; i++)
        {
            // ... then check and potentially react to each.  If the reaction happens, exit the function.
            if (conditionCollections[i].CheckAndReact())
            {
                return;
            }
        }

        // If none of the reactions happened, use the default ReactionCollection.
        defaultReactionCollection.React();
    }
Esempio n. 26
0
    // Reference to the Item which has to be drag-and-dropped.

    // This is called by the Interactable one at a time for each of its ConditionCollections until one returns true.
    public bool CheckAndReact(Item dragDropItem)
    {
        if (!Equals(this.dragDropItem, dragDropItem))
        {
            return(false);
        }

        // If there is an ReactionCollection assigned, call its React function.
        if (reactionCollection)
        {
            reactionCollection.React();
        }

        // A Reaction happened so return true.
        return(true);
    }
Esempio n. 27
0
 public bool CheckAndReact(MonoBehaviour mono)
 {
     for (int i = 0; i < conditions.Length; i++)
     {
         if (!conditions[i].isSatisfied())
         {
             return(false);
         }
     }
     // All conditions satisfied: Do reactions
     if (reaction)
     {
         reaction.React(mono);
     }
     return(true);
 }
Esempio n. 28
0
 public void barUpdate(float time)
 {
     value = value + time * barModifier.getMoneyModifier();
     if ((int)value == MAX / 4)
     {
         lowReaction.React();
     }
     if ((int)value == MAX / 10)
     {
         veryLowReaction.React();
     }
     if ((int)value < 0)
     {
         noMoreReaction.React();
     }
 }
    public ReactionCollection reactionCollection;             // reakcje do zrealizowania


    public bool CheckAndReact()                             // musimy teraz sprawdzic i jesli konieczne to zareagowac, defaultowo bedzie zwracac true
    {
        for (int i = 0; i < requiredConditions.Length; i++) // musimy sprawdzic wszystkie nasze kondycje w for loop,
        {
            if (!AllConditions.CheckCondition(requiredConditions[i]))
            {
                return(false); //chcemy sprawdzac tylko czy jakis warunek NIE jest spełniony
            }
        }

        if (reactionCollection) // jezeli wszystkie warunki zostaly spelnione to trzeba wyzwolic funkcje React
        {
            reactionCollection.React();
        }

        return(true);
    }
    public bool CheckAndReact()
    {
        for (int i = 0; i < requiredConditions.Length; i++)
        {
            if (!AllConditions.CheckCondition(requiredConditions[i]))  //Checks if all the conditions are met, if they are not then it returns false
            {
                return(false);
            }
        }

        if (ReactionCollection)
        {
            ReactionCollection.React(); //if the conditions have been met and there are some reactions, then call them
        }

        return(true);
    }