Beispiel #1
0
            private void SpawnNpc(Vector3 position, Quaternion rotation)
            {
                NPCPlayerApex npc = (NPCPlayerApex)GameManager.server.CreateEntity(NPC_PREFAB, position, rotation);

                if (npc == null)
                {
                    return;
                }

                npc.enableSaving = false;
                npc.startHealth  = _settings.NpcHealth;
                npc.Spawn();
                npc.displayName = _settings.NpcName;
                npc.InitializeHealth(_settings.NpcHealth, _settings.NpcHealth);
                npc.Stats.VisionRange            = _settings.NpcAggression + 3f;
                npc.Stats.DeaggroRange           = _settings.NpcAggression + 2f;
                npc.Stats.AggressionRange        = _settings.NpcAggression + 1f;
                npc.Stats.LongRange              = _settings.NpcAggression;
                npc.Stats.MaxRoamRange           = _settings.NpcRadius;
                npc.Stats.Hostility              = 1f;
                npc.Stats.Defensiveness          = 1f;
                npc.Stats.OnlyAggroMarkedTargets = true;
                npc.InitFacts();

                npc.gameObject.AddComponent <NavigationComponent>()
                ?.SetDestination(position);

                CacheAdd(npc);

                npc.Invoke(() => GiveKit(npc, _settings.Kits.GetRandom(), _settings.UseKits), 2f);
            }
Beispiel #2
0
    public void SpawnScientist(Vector3 spawnPos)
    {
        Quaternion    quaternion = Quaternion.identity;
        NPCPlayerApex component  = GameManager.server.CreateEntity(this.scientistPrefab.resourcePath, spawnPos, quaternion, true).GetComponent <NPCPlayerApex>();

        component.Spawn();
        component.Mount(this);
        component.Stats.VisionRange            = 203f;
        component.Stats.DeaggroRange           = 202f;
        component.Stats.AggressionRange        = 201f;
        component.Stats.LongRange              = 200f;
        component.Stats.Hostility              = 0f;
        component.Stats.Defensiveness          = 0f;
        component.Stats.OnlyAggroMarkedTargets = true;
        component.InitFacts();
    }