Skip to content

Commit

Permalink
Merge pull request #69 from rygo6/master
Browse files Browse the repository at this point in the history
GoProxyProp. Tagging. Unity 5 Auto-update.
  • Loading branch information
mrcarriere committed Apr 22, 2015
2 parents 7f6afcc + d7e89d4 commit bbebbb7
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Assets/Demo/scripts/FPSHUD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void Awake()

void Start()
{
if( !guiText )
if( !GetComponent<GUIText>() )
{
Debug.Log("UtilityFramesPerSecond needs a GUIText component!");
enabled = false;
Expand All @@ -55,18 +55,18 @@ void Update()
// display two fractional digits (f2 format)
float fps = accum/frames;
string format = System.String.Format("{0:F2} FPS",fps);
guiText.text = format;
GetComponent<GUIText>().text = format;

if( fps < 20 )
{
guiText.material.color = Color.yellow;
GetComponent<GUIText>().material.color = Color.yellow;
}
else
{
if( fps < 10 )
guiText.material.color = Color.red;
GetComponent<GUIText>().material.color = Color.red;
else
guiText.material.color = Color.green;
GetComponent<GUIText>().material.color = Color.green;

timeleft = updateInterval;
accum = 0.0F;
Expand Down
33 changes: 33 additions & 0 deletions Assets/Plugins/GoKit/Go.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,39 @@ public static bool removeTween( AbstractGoTween tween )
return false;
}

/// <summary>
/// removes the Tween with specific tag
/// </summary>
public static void removeTweenWithTag( string tag )
{
List<AbstractGoTween> tweenList = tweensWithTag( tag );
if( tweenList != null )
{
foreach( var tween in tweenList )
{
removeTween( tween );
}
}
}

/// <summary>
/// returns a list of all Tweens, TweenChains and TweenFlows with the given tag
/// </summary>
public static List<AbstractGoTween> tweensWithTag( string tag )
{
List<AbstractGoTween> list = null;
foreach( var tween in _tweens )
{
if( tween.tag == tag )
{
if( list == null )
list = new List<AbstractGoTween>();
list.Add( tween );
}
}

return list;
}

/// <summary>
/// returns a list of all Tweens, TweenChains and TweenFlows with the given id
Expand Down
14 changes: 14 additions & 0 deletions Assets/Plugins/GoKit/GoProxyProp.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections;

public class GoProxyProp<T>
{

public T value { get; set; }

public GoProxyProp( T startValue )
{
value = startValue;
}

}
3 changes: 2 additions & 1 deletion Assets/Plugins/GoKit/base/AbstractGoTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
/// </summary>
public abstract class AbstractGoTween
{
public int id = 0; // optional id used for identifying this tween
public int id { get; set; } // optional id used for identifying this tween
public string tag { get; set; } // optional tag used for identifying this tween
public GoTweenState state { get; protected set; } // current state of the tween
public float duration { get; protected set; } // duration for a single loop
public float totalDuration { get; protected set; } // duration for all loops of this tween
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public override void init( GoTween owner )
if( owner.target is Material )
_target = (Material)owner.target;
else if( owner.target is GameObject )
_target = ((GameObject)owner.target).renderer.material;
_target = ((GameObject)owner.target).GetComponent<Renderer>().material;
else if( owner.target is Transform )
_target = ((Transform)owner.target).renderer.material;
_target = ((Transform)owner.target).GetComponent<Renderer>().material;
else if( owner.target is Renderer )
_target = ((Renderer)owner.target).material;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public override void init( GoTween owner )
if( owner.target is Material )
_target = (Material)owner.target;
else if( owner.target is GameObject )
_target = ((GameObject)owner.target).renderer.material;
_target = ((GameObject)owner.target).GetComponent<Renderer>().material;
else if( owner.target is Transform )
_target = ((Transform)owner.target).renderer.material;
_target = ((Transform)owner.target).GetComponent<Renderer>().material;
else if( owner.target is Renderer )
_target = ((Renderer)owner.target).material;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public override void init( GoTween owner )
if( owner.target is Material )
_target = (Material)owner.target;
else if( owner.target is GameObject )
_target = ((GameObject)owner.target).renderer.material;
_target = ((GameObject)owner.target).GetComponent<Renderer>().material;
else if( owner.target is Transform )
_target = ((Transform)owner.target).renderer.material;
_target = ((Transform)owner.target).GetComponent<Renderer>().material;
else if( owner.target is Renderer )
_target = ((Renderer)owner.target).material;

Expand Down
Binary file modified ProjectSettings/GraphicsSettings.asset
Binary file not shown.
Binary file added ProjectSettings/NavMeshAreas.asset
Binary file not shown.
Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.

0 comments on commit bbebbb7

Please sign in to comment.