コード例 #1
0
        private void SpawnBlood(DamageInfo info)
        {
            if (AI.IsTurtle(this.m_AI.m_ID) || this.m_AI.m_ID == AI.AIID.ArmadilloThreeBanded)
            {
                return;
            }
            AIManager.BloodFXType key  = info.m_DamageItem ? info.m_DamageItem.m_Info.m_BloodFXType : AIManager.BloodFXType.Blunt;
            List <string>         list = AIManager.Get().m_BloodFXNames[(int)key];

            if (list.Count == 0)
            {
                DebugUtils.Assert("Missing blood fxes!", true, DebugUtils.AssertType.Info);
                return;
            }
            string text = list[UnityEngine.Random.Range(0, list.Count)];

            text += ((this.m_AI.m_Params.m_Human || this.m_AI.m_Params.m_BigAnimal) ? "_M" : "_S");
            Vector3     vector             = Vector3.zero;
            RagdollBone closestRagdollBone = this.m_AI.GetClosestRagdollBone(info.m_Position);

            if (closestRagdollBone)
            {
                vector = closestRagdollBone.transform.position;
            }
            else
            {
                vector = base.transform.position;
            }
            Vector3 forward = (info.m_Damager && info.m_Damager.IsPlayer()) ? (Camera.main.transform.position - Camera.main.transform.right - vector).normalized : (-info.m_HitDir);

            ParticlesManager.Get().Spawn(text, vector, Quaternion.LookRotation(forward), Vector3.zero, null, -1f, false);
        }
コード例 #2
0
        public override void OnTakeDamage(DamageInfo info)
        {
            base.OnTakeDamage(info);
            AIManager.BloodFXType key  = (!info.m_DamageItem) ? AIManager.BloodFXType.Blunt : info.m_DamageItem.m_Info.m_BloodFXType;
            List <string>         list = AIManager.Get().m_BloodFXNames[(int)key];

            if (list.Count == 0)
            {
                DebugUtils.Assert("Missing blood fxes!", true, DebugUtils.AssertType.Info);
                return;
            }
            string text = list[UnityEngine.Random.Range(0, list.Count)];

            text += ((!this.m_AI.m_Params.m_Human && !this.m_AI.m_Params.m_BigAnimal) ? "_S" : "_M");
            Vector3 vector = Vector3.zero;

            if (this.m_AI.m_RagdollBones.Count > 0)
            {
                float num = float.MaxValue;
                foreach (Collider collider in this.m_AI.m_RagdollBones.Keys)
                {
                    Vector3 vector2 = collider.ClosestPoint(info.m_Position);
                    float   num2    = vector2.Distance(info.m_Position);
                    if (num2 < num)
                    {
                        vector = vector2;
                        Transform transform = collider.transform;
                        num = num2;
                    }
                }
            }
            else
            {
                vector = base.transform.position;
            }
            ParticlesManager.Get().Spawn(text, vector, Quaternion.LookRotation((Camera.main.transform.position - Camera.main.transform.right - vector).normalized), null);
            this.m_DamageAudioSource.Stop();
            this.m_DamageAudioSource.clip = AIManager.Get().m_FleshHitSounds[UnityEngine.Random.Range(0, AIManager.Get().m_FleshHitSounds.Count)];
            this.m_DamageAudioSource.Play();
        }
コード例 #3
0
ファイル: ItemInfo.cs プロジェクト: looki666/Green-Hell
 protected virtual void LoadParams(Key key)
 {
     if (key.GetName() == "CanBeAddedToInventory")
     {
         this.m_CanBeAddedToInventory = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "CanBeRemovedFromInventory")
     {
         this.m_CanBeRemovedFromInventory = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "CanBeFocusedInInventory")
     {
         this.m_CanBeFocusedInInventory = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "CantBeDraggedInInventory")
     {
         this.m_CantBeDraggedInInventory = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "HarvestringResult")
     {
         string   svalue = key.GetVariable(0).SValue;
         string[] array  = svalue.Split(new char[]
         {
             ';'
         });
         for (int i = 0; i < array.Length; i++)
         {
             this.m_HarvestingResultItems.Add((ItemID)Enum.Parse(typeof(ItemID), array[i]));
         }
         if (this.m_HarvestingResultItems.Count > 0)
         {
             this.m_Harvestable = true;
         }
     }
     else if (key.GetName() == "Eatable")
     {
         this.m_Eatable = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "Drinkable")
     {
         this.m_Drinkable = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "CanEquip")
     {
         this.m_CanEquip = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "Mass")
     {
         this.m_Mass = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "Components")
     {
         string   svalue2 = key.GetVariable(0).SValue;
         string[] array2  = svalue2.Split(new char[]
         {
             ';'
         });
         for (int j = 0; j < array2.Length; j++)
         {
             string[] array3 = array2[j].Split(new char[]
             {
                 '*'
             });
             ItemID key2 = (ItemID)Enum.Parse(typeof(ItemID), array3[0]);
             this.m_Components[(int)key2] = ((array3.Length <= 1) ? 1 : int.Parse(array3[1]));
         }
     }
     else if (key.GetName() == "RequiredTool")
     {
         this.m_RequiredTool = (ItemID)Enum.Parse(typeof(ItemID), key.GetVariable(0).SValue);
     }
     else if (key.GetName() == "HudInfoDisplayOffset")
     {
         string   svalue3 = key.GetVariable(0).SValue;
         string[] array4  = svalue3.Split(new char[]
         {
             ';'
         });
         this.m_HudInfoDisplayOffset = new Vector3(float.Parse(array4[0]), float.Parse(array4[1]), float.Parse(array4[2]));
     }
     else if (key.GetName() == "Health")
     {
         this.m_Health    = key.GetVariable(0).FValue;
         this.m_MaxHealth = this.m_Health;
     }
     else if (key.GetName() == "HealthLossPerSec")
     {
         this.m_HealthLossPerSec = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "DamageSelf")
     {
         this.m_DamageSelf = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "CanBeDamaged")
     {
         this.m_CanBeDamaged = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "DestroyOnDrop")
     {
         this.m_DestroyOnDrop = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "GrabSound")
     {
         this.m_GrabSound = key.GetVariable(0).SValue;
     }
     else if (key.GetName() == "BackpackPocket")
     {
         this.m_BackpackPocket = (BackpackPocket)Enum.Parse(typeof(BackpackPocket), key.GetVariable(0).SValue);
     }
     else if (key.GetName() == "MakeFireStaminaConsumptionMul")
     {
         this.m_MakeFireStaminaConsumptionMul = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "DamageType")
     {
         this.m_DamageType = (DamageType)Enum.Parse(typeof(DamageType), key.GetVariable(0).SValue);
     }
     else if (key.GetName() == "ReceiveDamageType")
     {
         string[] array5 = key.GetVariable(0).SValue.Split(new char[]
         {
             ';'
         });
         for (int k = 0; k < array5.Length; k++)
         {
             int num = this.m_ReceiveDamageType;
             num |= (int)Enum.Parse(typeof(DamageType), array5[k]);
             this.m_ReceiveDamageType = num;
         }
     }
     else if (key.GetName() == "Icon")
     {
         this.m_IconName = key.GetVariable(0).SValue;
     }
     else if (key.GetName() == "AdditionalIcon")
     {
         this.m_AdditionalIcon = (ItemAdditionalIcon)Enum.Parse(typeof(ItemAdditionalIcon), key.GetVariable(0).SValue);
     }
     else if (key.GetName() == "Static")
     {
         this.m_Static = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "Prefab_Destroyed")
     {
         this.m_DestroyedPrefabName = key.GetVariable(0).SValue;
     }
     else if (key.GetName() == "ItemsToBackpackOnDestroy")
     {
         string[] array6 = key.GetVariable(0).SValue.Split(new char[]
         {
             ';'
         });
         for (int l = 0; l < array6.Length; l++)
         {
             string[] array7 = array6[l].Split(new char[]
             {
                 '*'
             });
             ItemID item = (ItemID)Enum.Parse(typeof(ItemID), array7[0]);
             this.m_ItemsToBackpackOnDestroy.Add(item);
         }
     }
     else if (key.GetName() == "Destroyed_Falling")
     {
         this.m_DestroyedIsFalling = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "CutSystem")
     {
         this.m_CutData = new List <CutData>();
         string   svalue4 = key.GetVariable(0).SValue;
         string[] array8  = svalue4.Split(new char[]
         {
             ';'
         });
         for (int m = 0; m < array8.Length; m++)
         {
             CutData  cutData = new CutData();
             string[] array9  = array8[m].Split(new char[]
             {
                 ','
             });
             cutData.m_DummyName = array9[0];
             int.TryParse(array9[1], out cutData.m_BlendShapeIndex);
             float.TryParse(array9[2], out cutData.m_MaxHealth);
             cutData.m_Health = cutData.m_MaxHealth;
             cutData.m_DestroyedPrefabName = array9[3];
             this.m_CutData.Add(cutData);
         }
     }
     else if (key.GetName() == "ActiveInNotepad")
     {
         this.m_ActiveInNotepad = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "InventoryScale")
     {
         this.m_InventoryScale = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "ParticleOnHit")
     {
         this.m_ParticleOnHit = key.GetVariable(0).SValue;
     }
     else if (key.GetName() == "Craftable")
     {
         this.m_Craftable = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "ThrowForce")
     {
         this.m_ThrowForce = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "ThrowTorque")
     {
         this.m_ThrowTorque = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "PoisonDebuff")
     {
         this.m_PoisonDebuff = key.GetVariable(0).IValue;
     }
     else if (key.GetName() == "HealingTimeDec")
     {
         this.m_HealingTimeDec = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "MakeFireDuration")
     {
         this.m_MakeFireDuration = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "DestroyableDestroySound")
     {
         this.m_DestroyableDestroySound     = key.GetVariable(0).SValue;
         this.m_DestroyableDestroySoundHash = Animator.StringToHash(this.m_DestroyableDestroySound);
     }
     else if (key.GetName() == "DestroyableFallSound")
     {
         this.m_DestroyableFallSound     = key.GetVariable(0).SValue;
         this.m_DestroyableFallSoundHash = Animator.StringToHash(this.m_DestroyableFallSound);
     }
     else if (key.GetName() == "ThrowDamage")
     {
         this.m_ThrowDamage = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "DestroyByItemsManager")
     {
         this.m_DestroyByItemsManager = (key.GetVariable(0).IValue != 0);
     }
     else if (key.GetName() == "LockedInfoID")
     {
         this.m_LockedInfoID = key.GetVariable(0).SValue;
     }
     else if (key.GetName() == "AddFirecamBurningTime")
     {
         this.m_AddFirecamBurningTime = key.GetVariable(0).FValue;
     }
     else if (key.GetName() == "BloodFXType")
     {
         this.m_BloodFXType = (AIManager.BloodFXType)Enum.Parse(typeof(AIManager.BloodFXType), key.GetVariable(0).SValue);
     }
 }