This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| public delegate void InputKeyDelegate (KeyCode key); | |
| public delegate void InputAxisDelegate (string name,float value); | |
| public class InputEvents : MonoBehaviour | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| [RequireComponent (typeof(SpriteRenderer))] | |
| public class SpriteAnimator : MonoBehaviour | |
| { | |
| public List<Sprite> frames = new List<Sprite> (); | |
| public float fps = 15; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEditor; | |
| //Version 0.21 | twitter:@izm update for DK2 | |
| //Version 0.2 | s.b.Newsom Edition | |
| //Source from http://answers.unity3d.com/questions/179775/game-window-size-from-editor-window-in-editor-mode.html | |
| //Modified by seieibob for use at the Virtual Environment and Multimodal Interaction Lab at the University of Maine. | |
| //Use however you'd like! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class ObliqueCameraProjection : MonoBehaviour | |
| { | |
| private Matrix4x4 originalProjection; | |
| public Vector2 slideViewport; | |
| public Vector2 slideFrustum; | |
| public Vector2 slideFarClip; // compound slideViewport and slideFrustum | |
| public Vector2 skew; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| /// <summary> | |
| /// Put this script on a camera, assign a target and the camera will always look at that target, smoothly following it. | |
| /// </summary> | |
| public class CameraLookAt : MonoBehaviour { | |
| public Transform target; //Look at this | |
| private Transform aimTarget; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| public class PlayAnimationWithoutTimeScale : MonoBehaviour { | |
| public Animation targetAnimation; | |
| public string stateName; | |
| AnimationState targetState; | |
| float lastRealTime = 0.0f; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var number = 44.36m; | |
| var formatted = number.ToString("0.##\\%"); // "44.36%" | |
| // format string @"0.##\%" works too | |
| // using String.Format() | |
| var sformatted = String.Format("{0:0.##\\%}", number); // "44.36%" | |
| String.Format("Value: {0:P2}.", 0.8526) // formats as 85.26 % (varies by culture) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AnimatorStateInfo info = upgradeAnimator.GetCurrentAnimatorStateInfo(0); | |
| if(info.nameHash == Animator.StringToHash("Base Layer.CardUpgrading")){ | |
| Debug.Log("UICardDetailSlot::Update >> Base.CardUpgrading"); | |
| } | |
| else if(info.nameHash == Animator.StringToHash("Base Layer.UpgradeSuccess")){ | |
| Debug.Log("UICardDetailSlot::Update >> Base.UpgradeSuccess"); | |
| } | |
| else if(info.nameHash == Animator.StringToHash("Base Layer.New State")){ | |
| Debug.Log("UICardDetailSlot::Update >> Base.New State"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void TriggerAnimator (int i) | |
| { | |
| isEnabled = false; | |
| upgradeAnimator.SetInteger ("stat", i); | |
| upgradeAnimator.SetTrigger ("init"); | |
| StartCoroutine(UpgradeAnimationEnd()); | |
| } | |
| // void Update(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using System.Collections; | |
| /// <summary> | |
| /// Observer or subscriber in Observe Design Pattern | |
| /// It register(or subscribe) Boiled event in Heater at Main::Start(). When water boiled, | |
| /// it receives BoiledEventArgs and Object sender. Do logic base on those received data. | |
| /// </summary> | |
| public class Alert : MonoBehaviour { |