コード例 #1
0
    static public NPCPrototype GetRandomChar()
    {
        ValidateDatabase();
        NPCPrototype cData = charPrototypes[Random.Range(0, charPrototypes.Count)];

        return(ScriptableObject.Instantiate(cData) as NPCPrototype);
    }
コード例 #2
0
    static public IEntity CreateCharacter(NPCPrototype cd)
    {
        IEntity IEntity = null;

        IEntity = new NonPlayerCharacter(cd);

        return(IEntity);
    }
コード例 #3
0
    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);
    }
コード例 #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);
 }