Exemple #1
0
    public void MoveNpc(int spawnTriggerId, string patrolDataName)
    {
        (PatrolData, List <WayPoint>)patrolData = MapEntityStorage.GetPatrolData(Field.MapId, patrolDataName);

        MapEventNpcSpawnPoint spawnPoint = MapEntityStorage.GetMapEventNpcSpawnPoint(Field.MapId, spawnTriggerId);

        if (spawnPoint is null)
        {
            return;
        }

        foreach (string npcId in spawnPoint.NpcIds)
        {
            if (!int.TryParse(npcId, out int id))
            {
                continue;
            }

            IFieldActor <NpcMetadata> fieldNpc = Field.State.Npcs.Values.FirstOrDefault(x => x.Value.Id == id);
            if (fieldNpc is null)
            {
                continue;
            }

            // Just setting the coord as the last waypoint for now, replace with moveTo later
            // fieldNpc.MoveTo(patrolData.Item2.Last().Position);
            fieldNpc.Coord = patrolData.Item2.Last().Position.ToFloat();
        }
    }
 public void MoveNpc(int spawnTriggerId, string patrolDataName)
 {
     PatrolData patrolData = MapEntityStorage.GetPatrolData(Field.MapId, patrolDataName);
 }