예제 #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var l = EditorGUI.BeginProperty(position, label, property);

            position        = EditorGUI.PrefixLabel(position, l);
            position.height = EditorGUIUtility.singleLineHeight;
            var block = property.FindPropertyRelative("block");

            Fungus.Block b = block.objectReferenceValue as Fungus.Block;

            if (block.objectReferenceValue != null && lastFlowchart == null)
            {
                if (b != null)
                {
                    lastFlowchart = b.GetFlowchart();
                }
            }

            lastFlowchart = EditorGUI.ObjectField(position, lastFlowchart, typeof(Fungus.Flowchart), true) as Fungus.Flowchart;
            position.y   += EditorGUIUtility.singleLineHeight;
            if (lastFlowchart != null)
            {
                b = Fungus.EditorUtils.BlockEditor.BlockField(position, new GUIContent("None"), lastFlowchart, b);
            }
            else
            {
                EditorGUI.PrefixLabel(position, new GUIContent("Flowchart Required"));
            }

            block.objectReferenceValue = b;

            block.serializedObject.ApplyModifiedProperties();
            property.serializedObject.ApplyModifiedProperties();
            EditorGUI.EndProperty();
        }
예제 #2
0
        private void OnItemEquipping()
        {
            if (flowchart == null && flowchartName != null && flowchartName.Trim().Length != 0)
            {
                flowchart = GameObject.Find(flowchartName).GetComponent <Fungus.Flowchart>();
            }

            flowchart.ExecuteBlock(blockName);
            EventHandler.UnregisterEvent(gameObject, "OnInventoryItemEquipping", OnItemEquipping);
        }
예제 #3
0
        void Start()
        {
            if (flowchart == null && flowchartName != null && flowchartName.Trim().Length != 0)
            {
                flowchart = GameObject.Find("/Fungus/Flowcharts/" + flowchartName).GetComponent <Fungus.Flowchart>();
            }

            behaviorTreeController = GetComponentInParent <BehaviorTreeController>();
            health       = GetComponentInParent <CustomHealth>();
            behaviorTree = GetComponentInParent <BehaviorTree>();
            navMeshAgent = GetComponentInParent <NavMeshAgent>();
        }
예제 #4
0
        void Start()
        {
            behaviorTree    = GetComponent <BehaviorTree>();
            deathmatchAgent = GetComponent <DeathmatchAgent>();
            navMeshAgent    = GetComponent <NavMeshAgent>();

            if (flowchart == null && flowchartName != null && flowchartName.Trim().Length != 0)
            {
                flowchart = GameObject.Find("/Fungus/Flowcharts/" + flowchartName).GetComponent <Fungus.Flowchart>();
            }

            trackEvent.AddListener(TrackTargetsInLayers);
        }
예제 #5
0
        private void pickPocket()
        {
            int pickpocket = Random.Range(1, 9);

            if (pickpocket >= pickpocketLevel)
            {
                storageInventory.ToggleStorage();
            }
            else
            {
                Fungus.Flowchart flowchart = GameObject.Find("/Fungus/Flowcharts/Messages/pickpocket_failed").GetComponent <Fungus.Flowchart>();
                flowchart.ExecuteBlock("Main");
            }
        }
예제 #6
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var l        = EditorGUI.BeginProperty(position, label, property);
            var startPos = position;

            position        = EditorGUI.PrefixLabel(position, l);
            position.height = EditorGUIUtility.singleLineHeight;
            var variable = property.FindPropertyRelative("variable");

            Fungus.Variable v = variable.objectReferenceValue as Fungus.Variable;

            if (variable.objectReferenceValue != null && lastFlowchart == null)
            {
                if (v != null)
                {
                    lastFlowchart = v.GetComponent <Flowchart>();
                }
            }

            lastFlowchart = EditorGUI.ObjectField(position, lastFlowchart, typeof(Fungus.Flowchart), true) as Fungus.Flowchart;
            position.y   += EditorGUIUtility.singleLineHeight;
            if (lastFlowchart != null)
            {
                var ourPos = startPos;
                ourPos.y = position.y;
                var prefixLabel = new GUIContent(v != null ? v.GetType().Name : "No Var Selected");
                EditorGUI.indentLevel++;
                VariableEditor.VariableField(variable,
                                             prefixLabel,
                                             lastFlowchart,
                                             "<None>",
                                             null,
                                             //lable, index, elements
                                             (s, t, u) => (EditorGUI.Popup(ourPos, s, t, u)));


                EditorGUI.indentLevel--;
            }
            else
            {
                EditorGUI.PrefixLabel(position, new GUIContent("Flowchart Required"));
            }

            variable.serializedObject.ApplyModifiedProperties();
            property.serializedObject.ApplyModifiedProperties();
            EditorGUI.EndProperty();
        }
예제 #7
0
        void Start()
        {
            health              = GetComponent(typeof(CharacterHealth)) as CharacterHealth;
            behaviorTree        = GetComponent <BehaviorTree>();
            deathmatchAgent     = GetComponent <DeathmatchAgent>();
            navMeshAgent        = GetComponent <NavMeshAgent>();
            characterController = GetComponent <RigidbodyCharacterController>();
            speedChange         = GetComponent <SpeedChange>();
            inventory           = GetComponent <Opsive.ThirdPersonController.Wrappers.Inventory>();

            if (flowchart == null && flowchartName != null && flowchartName.Trim().Length != 0)
            {
                flowchart = GameObject.Find("/Fungus/Flowcharts/" + flowchartName).GetComponent <Fungus.Flowchart>();
            }

            trackEvent.AddListener(TrackTargetsInLayers);
        }
예제 #8
0
        private void openLocker()
        {
            if (lockLevel > 0 && !IsInCriminalMode())
            {
                Fungus.Flowchart flowchart = GameObject.Find("/Fungus/Flowcharts/Messages/lockpick_requires_criminal_mode").GetComponent <Fungus.Flowchart>();
                flowchart.ExecuteBlock("Main");
                return;
            }

            int lockpick = Random.Range(1, 9);

            if (lockpick >= lockLevel)
            {
                lockLevel = 0;  //Now it is inlocked forever
                storageInventory.ToggleStorage();
            }
            else
            {
                Fungus.Flowchart flowchart = GameObject.Find("/Fungus/Flowcharts/Messages/lockpick_failed").GetComponent <Fungus.Flowchart>();
                flowchart.ExecuteBlock("Main");
            }
        }
예제 #9
0
        private void OpenLocker()
        {
            if (lockLevel > 0 && !IsInCriminalMode())
            {
                Fungus.Flowchart flowchart = GameObject.Find("/Story/Flowcharts/Messages/lockpick_requires_criminal_mode").GetComponent <Fungus.Flowchart>();
                flowchart.ExecuteBlock("Main");
                return;
            }

            int lockpick = Random.Range(1, 9);

            if (lockpick >= lockLevel)
            {
                UnlockForever();
                OpenStorage();
            }
            else
            {
                Fungus.Flowchart flowchart = GameObject.Find("/Story/Flowcharts/Messages/lockpick_failed").GetComponent <Fungus.Flowchart>();
                flowchart.ExecuteBlock("Main");
            }
        }
예제 #10
0
        public bool OnConsumeItem(Item item)
        {
            foreach (ItemAttribute attribute in item.itemAttributes)
            {
                if ("Health".Equals(attribute.attributeName))
                {
                    if ((currentHealth + attribute.attributeValue) > maxHealth)
                    {
                        currentHealth = maxHealth;
                    }
                    else
                    {
                        currentHealth += attribute.attributeValue;
                    }
                }
                else if ("Armor".Equals(attribute.attributeName))
                {
                    if ((currentArmor + attribute.attributeValue) > maxArmor)
                    {
                        currentArmor = maxArmor;
                    }
                    else
                    {
                        currentArmor += attribute.attributeValue;
                    }
                }
                else if ("Damage".Equals(attribute.attributeName))
                {
                    if ((currentDamage + attribute.attributeValue) > maxDamage)
                    {
                        currentDamage = maxDamage;
                    }
                    else
                    {
                        currentDamage += attribute.attributeValue;
                    }
                }
                else if ("ShotgunAmmo".Equals(attribute.attributeName))
                {
                    GameObject currentCharacter = characterSwitch.GetCurrentCharacter();
                    Opsive.ThirdPersonController.Wrappers.Inventory opsiveInventory = currentCharacter.GetComponent <Opsive.ThirdPersonController.Wrappers.Inventory>();
                    if (opsiveInventory.HasItem(1650912923))
                    {
                        opsiveInventory.PickupItem(1548588025, attribute.attributeValue, false, false);
                    }
                    else
                    {
                        Fungus.Flowchart flowchart = GameObject.Find("/Story/Flowcharts/Messages/noSuchWeapon").GetComponent <Fungus.Flowchart>();
                        flowchart.ExecuteBlock("Main");
                        return(false);
                    }
                }
                else if ("Flowchart".Equals(attribute.attributeName))
                {
                    GameObject currentCharacter = characterSwitch.GetCurrentCharacter();
                    currentCharacter.GetComponentInChildren <StorageInventory>().CloseStorage();
                    Fungus.Flowchart flowchart = GameObject.Find("/Story/Flowcharts/Items/item" + attribute.attributeValue).GetComponent <Fungus.Flowchart>();
                    if (flowchart.HasVariable("Interviewer"))
                    {
                        flowchart.SetStringVariable("Interviewer", currentCharacter.tag);
                    }

                    flowchart.ExecuteBlock("Start");
                }
            }
            return(true);
        }
예제 #11
0
 private void ShowPickPocketFailedMessage()
 {
     Fungus.Flowchart flowchart = GameObject.Find("/Story/Flowcharts/Messages/pickpocket_failed").GetComponent <Fungus.Flowchart>();
     flowchart.ExecuteBlock("Main");
 }