示例#1
0
文件: Item.cs 项目: yazici/ProcGenRPG
    public SpawnedObject getSpawnedObjectInformation(Area area, Transform location)
    {
        SpawnedObject.Builder builder = SpawnedObject.CreateBuilder();

        string description = WorldMap.getDescriptionForStarAt(area.position.x, area.position.y);

        GlobalPosition.Builder pBuilder = GlobalPosition.CreateBuilder();
        pBuilder.SetAreaX(area.position.x);
        pBuilder.SetAreaY(area.position.y);
        pBuilder.SetLocalX((int)location.position.x);
        pBuilder.SetLocalY((int)location.position.z);
        builder.SetObjectPosition(pBuilder.Build());

        Weapon weaponAssociated = gameObject.GetComponent <Weapon> ();

        if (weaponAssociated != null)
        {
            builder.SetObjectData(getDirectObject().getDirectObjectAsProtobuf(weaponAssociated));
        }
        else
        {
            builder.SetObjectData(getDirectObject().getDirectObjectAsProtobuf());
        }

        builder.SetDescription(description);

        return(builder.Build());
    }
示例#2
0
    public SpawnedObject getSpawnedObjectInformation(Area area)
    {
        SpawnedObject.Builder builder = SpawnedObject.CreateBuilder();

        string description = WorldMap.getDescriptionForStarAt(area.position.x, area.position.y);

        GlobalPosition.Builder pBuilder = GlobalPosition.CreateBuilder();
        pBuilder.SetAreaX(area.position.x);
        pBuilder.SetAreaY(area.position.y);
        pBuilder.SetLocalX((int)gameObject.transform.position.x);
        pBuilder.SetLocalY((int)gameObject.transform.position.z);
        builder.SetObjectPosition(pBuilder.Build());

        builder.SetObjectData(getDirectObject().getDirectObjectAsProtobuf());

        builder.SetDescription(description);

        EnemyData.Builder eBuilder = EnemyData.CreateBuilder();
        eBuilder.SetHealthRemaining((int)hp);
        builder.SetEnemyAttributes(eBuilder.Build());

        return(builder.Build());
    }