Skip to content
Snippets Groups Projects
Commit aadb9944 authored by william's avatar william
Browse files

adicionado rotacao a bola

parent 6ca6c25e
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,12 @@ using System;
public class BallController : MonoBehaviour
{
public static event Action<GameObject> ballContact;
private void Update()
{
transform.Rotate(Vector3.forward * UnityEngine.Random.Range(4, 10));
}
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.CompareTag("Ground") || collision.gameObject.CompareTag("Player"))
......
......@@ -9,7 +9,10 @@ public class CrossOverBehaviour : StateMachineBehaviour
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
action();
if (action != null)
{
action();
}
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
......@@ -21,7 +24,10 @@ public class CrossOverBehaviour : StateMachineBehaviour
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
action();
if (action != null)
{
action();
}
}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
......
......@@ -63,9 +63,7 @@ public class GameManager : MonoBehaviour
stopAnimations();
player.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
npc.GetComponent<Rigidbody2D>().velocity = Vector2.zero;
Debug.Log("finalizando turno");
yield return new WaitForSecondsRealtime(1);
Debug.Log("começando turno");
//do something
StartCoroutine(setupTurn());
}
......
......@@ -8,7 +8,10 @@ public class StepBackBehaviour : StateMachineBehaviour
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
action();
if (action != null)
{
action();
}
}
// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
......@@ -20,7 +23,10 @@ public class StepBackBehaviour : StateMachineBehaviour
// OnStateExit is called when a transition ends and the state machine finishes evaluating this state
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
action();
if (action != null)
{
action();
}
}
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment