예제 #1
0
파일: FadeOut.cs 프로젝트: Zamir7/urho
		public FadeOutState (FadeOut action, Node target)
			: base (action, target)
		{
			staticSprite = Target.GetComponent<StaticSprite2D>();
			if (staticSprite != null)
				return;

			shape = Target.GetComponent<Shape>();
			if (shape != null)
				return;

			throw new NotSupportedException("The node should have StaticSprite2D or Shape component");
		}
예제 #2
0
파일: FadeOut.cs 프로젝트: yrest/urho
        public FadeOutState(FadeOut action, Node target)
            : base(action, target)
        {
            staticSprite = Target.GetComponent <StaticSprite2D>();
            if (staticSprite != null)
            {
                return;
            }

            shape = Target.GetComponent <Shape>();
            if (shape != null)
            {
                return;
            }

            throw new NotSupportedException("The node should have StaticSprite2D or Shape component");
        }
예제 #3
0
		protected override void OnUpdate(float timeStep)
		{
			var input = Input;

			const float duration = 1f; //2s
			FiniteTimeAction action = null;

			if (input.GetKeyPress(Key.W))
			{
				action = new MoveBy(duration, new Vector3(0, 0, 5));
			}

			if (input.GetKeyPress(Key.S))
			{
				action = new MoveBy(duration, new Vector3(0, 0, -5));
			}

			if (input.GetKeyPress(Key.E))
			{
				action = new FadeIn(duration); 
			}

			if (input.GetKeyPress(Key.Q))
			{
				action = new FadeOut(duration);
			}

			if (input.GetKeyPress(Key.R))
			{
				action = new EaseElasticInOut(new ScaleBy(duration, 1.3f));
			}

			if (input.GetKeyPress(Key.G))
			{
				action = new TintTo(duration, NextRandom(1), NextRandom(1), NextRandom(1));
			}

			if (action != null)
			{
				//can be awaited
				boxNode.RunActionsAsync(action);
			}
			base.OnUpdate(timeStep);
		}