Exemplo n.º 1
0
 public override void ServerInit()
 {
     base.ServerInit();
     if (Barricade.nonWalkableArea < 0)
     {
         Barricade.nonWalkableArea = NavMesh.GetAreaFromName("Not Walkable");
     }
     if (Barricade.animalAgentTypeId < 0)
     {
         NavMeshBuildSettings settingsByIndex = NavMesh.GetSettingsByIndex(1);
         Barricade.animalAgentTypeId = ((NavMeshBuildSettings) ref settingsByIndex).get_agentTypeID();
     }
     if (Object.op_Equality((Object)this.NavMeshVolumeAnimals, (Object)null))
     {
         this.NavMeshVolumeAnimals = (NavMeshModifierVolume)((Component)this).get_gameObject().AddComponent <NavMeshModifierVolume>();
         this.NavMeshVolumeAnimals.set_area(Barricade.nonWalkableArea);
         this.NavMeshVolumeAnimals.AddAgentType(Barricade.animalAgentTypeId);
         this.NavMeshVolumeAnimals.set_center(Vector3.get_zero());
         this.NavMeshVolumeAnimals.set_size(Vector3.get_one());
     }
     if (!this.canNpcSmash)
     {
         if (Barricade.humanoidAgentTypeId < 0)
         {
             NavMeshBuildSettings settingsByIndex = NavMesh.GetSettingsByIndex(0);
             Barricade.humanoidAgentTypeId = ((NavMeshBuildSettings) ref settingsByIndex).get_agentTypeID();
         }
         if (!Object.op_Equality((Object)this.NavMeshVolumeHumanoids, (Object)null))
         {
             return;
         }
         this.NavMeshVolumeHumanoids = (NavMeshModifierVolume)((Component)this).get_gameObject().AddComponent <NavMeshModifierVolume>();
         this.NavMeshVolumeHumanoids.set_area(Barricade.nonWalkableArea);
         this.NavMeshVolumeHumanoids.AddAgentType(Barricade.humanoidAgentTypeId);
         this.NavMeshVolumeHumanoids.set_center(Vector3.get_zero());
         this.NavMeshVolumeHumanoids.set_size(Vector3.get_one());
     }
     else
     {
         if (!Object.op_Equality((Object)this.NpcTriggerBox, (Object)null))
         {
             return;
         }
         this.NpcTriggerBox = (NPCBarricadeTriggerBox) new GameObject("NpcTriggerBox").AddComponent <NPCBarricadeTriggerBox>();
         this.NpcTriggerBox.Setup(this);
     }
 }
Exemplo n.º 2
0
    public override void ServerInit()
    {
        NavMeshBuildSettings settingsByIndex;

        base.ServerInit();
        if (Barricade.nonWalkableArea < 0)
        {
            Barricade.nonWalkableArea = NavMesh.GetAreaFromName("Not Walkable");
        }
        if (Barricade.animalAgentTypeId < 0)
        {
            settingsByIndex             = NavMesh.GetSettingsByIndex(1);
            Barricade.animalAgentTypeId = settingsByIndex.agentTypeID;
        }
        if (this.NavMeshVolumeAnimals == null)
        {
            this.NavMeshVolumeAnimals      = base.gameObject.AddComponent <NavMeshModifierVolume>();
            this.NavMeshVolumeAnimals.area = Barricade.nonWalkableArea;
            this.NavMeshVolumeAnimals.AddAgentType(Barricade.animalAgentTypeId);
            this.NavMeshVolumeAnimals.center = Vector3.zero;
            this.NavMeshVolumeAnimals.size   = Vector3.one;
        }
        if (!this.canNpcSmash)
        {
            if (Barricade.humanoidAgentTypeId < 0)
            {
                settingsByIndex = NavMesh.GetSettingsByIndex(0);
                Barricade.humanoidAgentTypeId = settingsByIndex.agentTypeID;
            }
            if (this.NavMeshVolumeHumanoids == null)
            {
                this.NavMeshVolumeHumanoids      = base.gameObject.AddComponent <NavMeshModifierVolume>();
                this.NavMeshVolumeHumanoids.area = Barricade.nonWalkableArea;
                this.NavMeshVolumeHumanoids.AddAgentType(Barricade.humanoidAgentTypeId);
                this.NavMeshVolumeHumanoids.center = Vector3.zero;
                this.NavMeshVolumeHumanoids.size   = Vector3.one;
                return;
            }
        }
        else if (this.NpcTriggerBox == null)
        {
            this.NpcTriggerBox = (new GameObject("NpcTriggerBox")).AddComponent <NPCBarricadeTriggerBox>();
            this.NpcTriggerBox.Setup(this);
        }
    }
Exemplo n.º 3
0
 public override void ServerInit()
 {
     base.ServerInit();
     if (nonWalkableArea < 0)
     {
         nonWalkableArea = NavMesh.GetAreaFromName("Not Walkable");
     }
     if (animalAgentTypeId < 0)
     {
         animalAgentTypeId = NavMesh.GetSettingsByIndex(1).agentTypeID;
     }
     if (NavMeshVolumeAnimals == null)
     {
         NavMeshVolumeAnimals      = base.gameObject.AddComponent <NavMeshModifierVolume>();
         NavMeshVolumeAnimals.area = nonWalkableArea;
         NavMeshVolumeAnimals.AddAgentType(animalAgentTypeId);
         NavMeshVolumeAnimals.center = Vector3.zero;
         NavMeshVolumeAnimals.size   = Vector3.one;
     }
     if (!canNpcSmash)
     {
         if (humanoidAgentTypeId < 0)
         {
             humanoidAgentTypeId = NavMesh.GetSettingsByIndex(0).agentTypeID;
         }
         if (NavMeshVolumeHumanoids == null)
         {
             NavMeshVolumeHumanoids      = base.gameObject.AddComponent <NavMeshModifierVolume>();
             NavMeshVolumeHumanoids.area = nonWalkableArea;
             NavMeshVolumeHumanoids.AddAgentType(humanoidAgentTypeId);
             NavMeshVolumeHumanoids.center = Vector3.zero;
             NavMeshVolumeHumanoids.size   = Vector3.one;
         }
     }
     else if (NpcTriggerBox == null)
     {
         NpcTriggerBox = new GameObject("NpcTriggerBox").AddComponent <NPCBarricadeTriggerBox>();
         NpcTriggerBox.Setup(this);
     }
 }