Esempio n. 1
0
        public override BaseCorpse OnCreateCorpse(HTNAnimal target)
        {
            BaseCorpse baseCorpse;

            if (this.DeathEffect.isValid)
            {
                Effect.server.Run(this.DeathEffect.resourcePath, target, 0, Vector3.zero, Vector3.zero, null, false);
            }
            using (TimeWarning timeWarning = TimeWarning.New("Create corpse", 0.1f))
            {
                BaseCorpse navAgent = target.DropCorpse(this.CorpsePrefab.resourcePath);
                if (navAgent)
                {
                    if (target.AiDomain != null && target.AiDomain.NavAgent != null && target.AiDomain.NavAgent.isOnNavMesh)
                    {
                        navAgent.transform.position = navAgent.transform.position + (Vector3.down * target.AiDomain.NavAgent.baseOffset);
                    }
                    navAgent.InitCorpse(target);
                    navAgent.Spawn();
                    navAgent.TakeChildren(target);
                }
                baseCorpse = navAgent;
            }
            return(baseCorpse);
        }
 public override BaseCorpse OnCreateCorpse(HTNAnimal target)
 {
     if (this.DeathEffect.isValid)
     {
         Effect.server.Run(this.DeathEffect.resourcePath, (BaseEntity)target, 0U, Vector3.get_zero(), Vector3.get_zero(), (Connection)null, false);
     }
     using (TimeWarning.New("Create corpse", 0.1f))
     {
         BaseCorpse baseCorpse = target.DropCorpse(this.CorpsePrefab.resourcePath);
         if (Object.op_Implicit((Object)baseCorpse))
         {
             if (Object.op_Inequality((Object)target.AiDomain, (Object)null) && Object.op_Inequality((Object)target.AiDomain.NavAgent, (Object)null) && target.AiDomain.NavAgent.get_isOnNavMesh())
             {
                 ((Component)baseCorpse).get_transform().set_position(Vector3.op_Addition(((Component)baseCorpse).get_transform().get_position(), Vector3.op_Multiply(Vector3.get_down(), target.AiDomain.NavAgent.get_baseOffset())));
             }
             baseCorpse.InitCorpse((BaseEntity)target);
             baseCorpse.Spawn();
             baseCorpse.TakeChildren((BaseEntity)target);
         }
         return(baseCorpse);
     }
 }