Skip to content

Instantly share code, notes, and snippets.

View zaneclaes's full-sized avatar

Zane Claes zaneclaes

View GitHub Profile
# MIT License
#
# Copyright (c) 2018, Zane Claes
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# MIT License
#
# Copyright (c) 2018, Zane Claes
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# MIT License
#
# Copyright (c) 2018, Zane Claes
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
// I created a shared base-class for both CreatureRenderer and CreatureCanvasRenderer, which removes tons and tons of copy/pasted code...
// Here's how I transform the vertices...
public void UpdateRenderingData() {
CreatureRenderModule.UpdateRenderingData(
creature_manager,
counter_clockwise,
ref vertices,
ref normals,
ref tangents,
@zaneclaes
zaneclaes / UVBoxes.cs
Last active November 6, 2017 14:43
UV Boxes for creature
MeshRenderBoneComposition comp =
creatureAsset.creature_manager.target_creature.render_composition;
List<MeshRenderRegion> regions = comp.getRegions();
foreach (MeshRenderRegion region in regions) {
Rect r = new Rect();
int uvIndex = region.getUVsIndex();
for (int i = 0; i < region.getNumPts(); i++) {
Vector2 p = new Vector2(region.store_uvs[uvIndex], region.store_uvs[uvIndex + 1]);
if (i == 0) {
r.xMax = r.xMin = (float)p.x;
MeshRenderBoneComposition comp =
creatureAsset.creature_manager.target_creature.render_composition;
List<MeshRenderRegion> regions = comp.getRegions();
foreach (MeshRenderRegion region in regions) {
Rect r = new Rect();
int uvIndex = region.getUVsIndex();
for (int i = 0; i < region.getNumPts(); i++) {
Vector2 p = new Vector2(region.store_uvs[uvIndex], region.store_uvs[uvIndex + 1]);
if (i == 0) {
r.xMax = r.xMin = (float)p.x;
WorldObjectNetworkObject wno = NetworkManager.Instance.WorldObjectNetworkObject.GetComponent<WorldObjectBehavior> ().networkObject;
// None of these fire:
wno.pendingInitialized += delegate(INetworkBehavior behavior, NetworkObject networkObject) {
Debug.Log ("[GLOBAL] PENDING initialized " + behavior);
};
wno.onReady += delegate {
Debug.Log ("[GLOBAL] onReady");
};
wno.readBinary += delegate(BeardedManStudios.BMSByte data) {
@zaneclaes
zaneclaes / MapSpawner.cs
Created March 20, 2016 19:26
Tiled Map Spawner
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
using IsoTools.Tiled;
using IsoTools.Internal;
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
//
// Direction.swift
// ForeverMaze
//
// Created by Zane Claes on 1/18/16.
// Copyright © 2016 inZania LLC. All rights reserved.
//
import Foundation
//
// Animation.swift
// ForeverMaze
//
// Created by Zane Claes on 1/18/16.
// Copyright © 2016 inZania LLC. All rights reserved.
//
import SpriteKit
import PromiseKit