static public NPCPrototype GetRandomChar()
    {
        ValidateDatabase();
        NPCPrototype cData = charPrototypes[Random.Range(0, charPrototypes.Count)];

        return(ScriptableObject.Instantiate(cData) as NPCPrototype);
    }
    static public IEntity CreateCharacter(NPCPrototype cd)
    {
        IEntity IEntity = null;

        IEntity = new NonPlayerCharacter(cd);

        return(IEntity);
    }
    public NPC AddNPCEntity(NPCData data)
    {
        //NPCPrototype proto = NPCDatabase.GetNPCPrototype(data.type);
        NPCPrototype proto = NPCDatabase.GetNPCPrototype(data.type);

        NPC temp = null;

        temp = new NPC(proto);
        temp.Spawn(GetMapTilePosition(data.TilePosition));
        return(temp);
    }
Example #4
0
 public NonPlayerCharacter(NPCPrototype proto) : base()
 {
     controller = new NPCCombatHandler(this);
     prototype  = proto;
     EntityName = prototype.characterName;
     Movement   = new NPCMovementComponent(this);
     SetToTile(TileMapManager.Instance.CurrentMap.GetTile(Random.Range(1, (int)TileMapManager.Instance.CurrentMap.mapSize.x), Random.Range(1, (int)TileMapManager.Instance.CurrentMap.mapSize.y)));
     Stats = proto.stats;
     Stats.GetHealth().Initialise(this);
     Graphics.sRenderer.sprite = proto.image;
     // loot = new LootableComponent(IEntity);
 }