Code Monkey home page Code Monkey logo

gokit's People

Contributors

adoraj avatar buddingmonkey avatar charlesgriffiths avatar dantreble avatar dmitriipetukhov avatar dmitriyyukhanov avatar etic avatar gregharding avatar henryclay avatar jceipek avatar johnsietsma avatar jpsarda avatar lukekellett avatar mattrix avatar maxloy avatar mrcarriere avatar nesh108 avatar philipcass avatar pixelpirate avatar prime31 avatar rhys-vdw avatar simonoliver avatar sp-bernat-centellas avatar swalls avatar timleader avatar tomasztunik avatar voxelboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gokit's Issues

GoTween

Just a request to update the wiki on this github to use the GoTween class instead of what I assume is the old Tween() API (such as in the Basics page). It confused me for awhile when trying to learn the API.

Android support to use assets created with the visual editor

Testing GoKit on my game I deployed to an Android phone and found that the Assets where not loading . I made some modifications to the original method in charge of handling the loading process and managed to get it working.

Since I don't use Git here is the solution: (replace the current method with the code bellow)

Class: GoSpline.cs

    /// <summary>
/// helper to get a node list from an asset created with the visual editor
/// </summary>
private static List<Vector3> nodeListFromAsset( string pathAssetName )
{

if UNITY_WEBPLAYER

        Debug.LogError( "The Web Player does not support loading files from disk." );
        return null;

else

    var path = string.Empty;
    if( !pathAssetName.EndsWith( ".asset" ) )
        pathAssetName += ".asset";

    byte[] bytes = null;

    if (Application.platform == RuntimePlatform.Android)
    {
        path = Path.Combine("jar:file://" + Application.dataPath + "!/assets/", pathAssetName);

        WWW loadAsset = new WWW(path);
        while (loadAsset.isDone) { } // maybe make a safety check here
        bytes = loadAsset.bytes;
    }
    else
    {
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            // on iOS at runtime, we load from the dataPath
            path = Path.Combine(Path.Combine(Application.dataPath, "Raw"), pathAssetName);
        }
        else
        {
            // default to looking in the StreamingAssets folder
            path = Path.Combine(Path.Combine(Application.dataPath, "StreamingAssets"), pathAssetName);
        }

        bytes = File.ReadAllBytes(path);
    } 

    return bytesToVector3List( bytes );

endif

}

Non functioning Tween when reusing a GoTween instance with modified TweenProperties

I'm saving instances of tweens that need to be reused often, with minor TweenProperty changes. Here's what my code looks like:

// declaration as a field of my class
private GoTween _myTween;

// setup
var config = new GoTweenConfig().setEaseType(GoEaseType.CircOut).startPaused();
_myTween = new GoTween(_myTarget, 1.0f, config);
_myTween.autoRemoveOnComplete = false; 
Go.addTween(_myTween);

// use
int newValue = Random(0, 100); // same tween, but a different value each time
_myTween.clearTweenProperties(); // get rid of old properties from last use
_myTween.addTweenProperty(new IntTweenProperty("MyIntProperty", newValue));
_myTween.goToAndPlay(0.0f); // play from the start

This works the first time the tween is used, but after that, the value set by the tween is always 0 instead of newValue.

From debugging, it looks like the newly added TweenProperty is never getting its prepareForUse() method called, which normally happens in GoTween's onInit(). I think either prepareForUse() should be called on new properties added via addTweenProperty() if the GoTween's _didInit is true, or there should be exposed a Reset() method to set the _didInit field back to false on the GoTween, so it will properly call prepareForUse() on all TweenProperties.

I'll experiment with these fixes and submit a pull request once I have a proper fix, but it would be nice to hear from an author with more knowledge of the code as to what the best solution is.

GoDummyPathEditor Enhancement

Hi prime31, I created a small enhancement to the Editor class so we can move the nodes to start at the location of the GameObject where the GoDummyPath is.

I added this script just bellow this script block:

if( GUILayout.Button( "Shift Path to Start at Origin" ) ) { ... }

Here is the code:

// shift the start point to the GameObject where the GoDummyPath is
    if (GUILayout.Button("Shift Path to Start at Object"))
    {
        Undo.RegisterUndo(_target, "Path Vector Changed");

        var offset = Vector3.zero;

        // see what kind of path we are. the simplest case is just a straight line
        var path = new GoSpline(_target.nodes, _target.forceStraightLinePath);
        if (path.splineType == SplineType.StraightLine)
            offset = _target.transform.position - _target.nodes[0];
        else
            offset = _target.transform.position - _target.nodes[1];

        for (var i = 0; i < _target.nodes.Count; i++)
            _target.nodes[i] += offset;

        GUI.changed = true;
    }

I hope you add this to the branch. I found this very useful to observe the path when creating some spawn nodes in my game and reusing previously saved paths.

You may want to create a method that receives the start position Vector3 as an argument to avoid code duplication in both buttons (Shift Path to Start at Origin and this new one I created)

Tweening Rotations Shortest Distance

If I want to tween a local euler rotation from 355,0,0 to 5,0,0, GoKit will calculate the distance as -350,0,0. Is there a way to get it to tween a distance of 10,0,0?

colorProp is not work when alpha 0 -> 255 with 2d tool kit

i use gokit with 2d tool kit.
i want to change tk2d sprite's alpha . 0 -> 255.


tk2dSprite mysprite;
mysprite = GetComponent();

//tween1 this function is well
GoTween tween1 = new GoTween(mysprite, 1f, new GoTweenConfig().colorProp("color",new Color(255,255,255,0)));

//this function is not good
GoTween tween2 = new GoTween(mysprite, 1f, new GoTweenConfig().colorProp("color",new Color(255,255,255,255)));


when tween1 , gradually mysprite color alpha becameing 0 .
when tween2 , suddenly mysprite color alpha 255.

what should i do ?

progressBar with scale bug

In Demo Scene - KitchenSinkManager:

    // Progress/Health bar
    var progressBar = UIProgressBar.create( "progressBar.png", 0, 0 );
    progressBar.positionFromBottomLeft( .05f, .02f );
    progressBar.resizeTextureOnChange = true;
    progressBar.localScale = new Vector3(1,1.5f,1);    <<just add this line
    progressBar.value = 0.4f;

the result is not expected...
I have try
progressBar.scale = new Vector3(1,1.5f,1); <<same result

GoTween Incompatible with IL2CPP scripting backend

Hey guys. As you may know, Apple just began enforcing the inclusion of 64-bit architecture in all ios submissions. For those created in Unity, this requires using the 'IL2CPP' scripting backend rather than 'Mono 2.1' in order to enable 'Universal' in the Architecture Settings.

Does Prime31 have any plans to update GoTween to accommodate this new restriction? Presently it works fine in the IDE, but most tweens cause errors on iOS.

Android streaming GoSpline asset bug?

in GoSpline.cs nodeListFromAsset

....
path = Path.Combine( "jar:file://" + Application.dataPath + "!/assets/", pathAssetName );
WWW loadAsset = new WWW( path );
while( loadAsset.isDone ) { } // maybe make a safety check here <<<<
...

I think this should be while not
while(!loadAsset.isDone) {}

How to check if Go has no animation running

I have a lot of objects and each running tweens, its a game like candy crush. The question is, is it possible to check if all tweens have completed without using each objects tween, like from "GoKit" instance in the scene or something?

Need help with playBackwards()

I'm trying to play the tweenchain backwards but somehow it only plays forward but when i do playBackwards() it's doing nothing.
One more thing, is it possible to remove a tween from chain after appending it ? thanks

Material color property should not be restricted to enum

GoMaterialColorType enum is a bit misguided. Shaders can use any string as a color variable name, so restricting the identifier to an enum is useless for many cases. In fact many stock Unity shaders use names that are not present in the enum (ie. "_TintColor"). Adding more elements to the enum will not fix the problem for anyone using custom shaders with masks/toon outlines/whatever.

People are used to supplying the full string when using Material.SetColor. It would be idiomatic to use a string here as well.

I'll make the fix and create a pull request if people agree.

Should I support the enum for back compatability or just remove it completely?

tick() is called once after onComplete

I have a TweenConfig that tweens the position of a Transform and manually sets a different final position in the onComplete handler. This final position is being overwritten in a final call to tick() in Tween.update() even though AbstractTween.update() is returning true.

I would expect onComplete to be the very last thing to be called before the tween is destroyed

Is there a way to save all running tweens?

For games that have a full-state save system, where basically everything non-static is saved on user request, is there a way to also save all currently running tweens? Is this built into the lib or something we would need to implement ourselves? (We already have a full-state save system.)

Thank you!

Built-in support for inserting functions into GoTweenCollections

If you want to call a function at a given point in a GoTweenChain or GoTweenFlow, you currently have to wrap the function in a GoTween object to add it to the collection.

new GoTweenChain()
    .appendDelay(1)
    .append(new GoTween(this, 0, new GoTweenConfig().onBegin(x => MyFunction()));

I'm wondering if GoKit should include a more explicit way of inserting functions into collections. Some potential ways of doing this could be:

  • Add a utility method that wraps a function in a GoTween object, eg. GoTweenUtils.Function(x => MyFunction())
  • Add methods directly to GoTweenChain and GoTweenFlow for inserting functions, such as GoTweenChain.appendFunction(), GoTweenChain.prependFunction(), and GoTweenFlow.insertFunction()

Thoughts?

Doesn't compile for Windows Phone 8

using the version from Unity Store and Unity 4.6 rc1

In GoDummyPathEditor.cs I had to set:

#if NETFX_CORE
using UnityEngine.Windows.File;
#else
using System.IO;
#endif

In GoSpline.cs 98 I had to set:

        var bytes = new byte[1]; //File.ReadAllBytes( path );

Canceling / destroying a tween collection

I have a number of related tweens which should run simultaneously and, sometimes, be canceled halfway collectively. I was hoping to use some kind of collection (GoTweenFlow seems promising) to manage these tweens, but AFAICS I can then only pause the tweens, not actually stop / destroy them through the collection. I would have to keep a separate list of tweens to call destroy() on, pretty much voiding the goal of the collection.

Am I missing something, or is this something that could/should be added?

[Question] Player Camera on Path

Hi, I'm trying to create a simple system with a path that follows my player when they are moving. This leads me into my question, is there a method that would allow me to get the closest point on a path from a gameobject's transform.

Here you can see my totally professional explanation made with paint on what I'm trying to accomplish.

2015-08-21_01-46-33

The image is in 2D for obvious reasons but the same would apply in a 3d space.

Visual Path Editor broken when using Unity 4

When using Unity 4, and trying to use GoKit Visual Path Editor, many of the features do not appear to work correctly. Namely:

-Curved paths are not visible unless the gameObject is deselected (essentially becoming useless). Paths do appear, however, when 'Force Straight Lines' is ticked.
-Snapping of the handles doesn't work

TweenConfig().localEulerAngles() bug

Currently, localEulerAngles behave the same as eulerAngles.

public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false )
{
    var prop = new EulerAnglesTweenProperty( endValue, isRelative );
// ....
}

Should be

public GoTweenConfig localEulerAngles( Vector3 endValue, bool isRelative = false )
{
    var prop = new EulerAnglesTweenProperty( endValue, isRelative, true );
// ....
}

License wording

Hi Mike,

A suggestion for a small change to the license. There's a bit which currently reads:

You can freely use it in as many games as you would like but you cannot distribute the source code either directly or compiled into a library outside of your game.

This would actually preclude anyone from forking it to send you pull requests (something I just did) since that counts as distributing the source directly outside a game. Perhaps it would be best to change it to read commercially distribute.

[Request] Tween value without using property

Hi. Is it possible to tween a value without converting it to a property?
say 0 to 1. LeanTween has a similar feature for most types. Here is an example

LeanTween.value(gameObject, (float val) => {
canvasGroup.alpha = val;
}, 1, 0, tweenTime);

What do you think about rearranging this repo so it could be a submodule or a subtree?

I have my projects set up where I clone different repos, with different components or functionality, into the main repo via git submodule functionality. The GoKit repo, being an entire Unity project, is not suited to doing that. Sparse-Checkout also results in a rather messy directory structure because it must create all directories from root. What do you think of the idea of making this repo, and potentially others, organized into a structure that allows someone to git submodule add, or git subtree add them into their project directly?

Documentation installation (via github?)

Since this isn't in the asset store, I'm trying to figure out the best way to install it, without simply cloning it and adding all the files to my project (though perhaps that's the best way?).

I haven't been successful going to the Package Manager and clicking on "Add from Git URL" and entering "https://github.com/prime31/GoKit.git"

What is the best way to install this plugin?

Thanks.

4 or more nodes bug

When I add (using visual editor at least) 4 or more nodes to a path the Begin and End nodes are never used.

The movement starts from the Node 1 and goes to Node n-1 (Before the End node).

I am using Unity 4 beta 7.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.