コード例 #1
0
 public override void Interact()
 {
     if (m_Interactor != null && flowchart != null)
     {
         inProgress = true;
         if (flowchart.HasVariable("Interviewer"))
         {
             flowchart.SetStringVariable("Interviewer", m_InteractorGameObject.tag);
         }
         flowchart.ExecuteBlock("Start");
         if (m_ShouldTurnToInerviewer && navMeshAgent != null && IsAlive())
         {
             destination = navMeshAgent.destination;
             DisableAI();
             SetDestination(m_InteractorGameObject.transform.position);
             StartCoroutine(CheckFacingInterviewer());
         }
         Fungus.BlockSignals.OnBlockEnd += OnBlockEnd;
     }
 }
コード例 #2
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);
        }