public void BallWasThrown() { if (CellMoveState == CellMotionState.Neutral) { CellMoveState = CellMotionState.wasThrownFromHand; } }
public void BallWasFired() { if (CellMoveState == CellMotionState.Neutral) { CellMoveState = CellMotionState.wasShotFromWeapon; } LocationOfTheCell = CellState.IsInAir; }
frameRate = 1f / 60f; //!the current frame rate (this needs to be adjusted to a value the is given by the Unity Engine) // Use this for initialization void Start() { Controls = FindObjectOfType <RaydraControls>(); //initialize the controls Rigidbody gr = this.GetComponent <Rigidbody>(); Gravity = 40; //the drag will determine how a ThePlayer = FindObjectOfType <RaydraPlayerz>(); X8Animator = ThePlayer.GetComponent <Animator>(); StateInfo = X8Animator.GetCurrentAnimatorStateInfo(0); X8Animator.SetBool("ThrowBall", false); LocationOfTheCell = CellState.IsInHand; CellMoveState = CellMotionState.Neutral; // Update is called once per frame }
void OnTriggerEnter(Collider entity) { // Debug.Log("ball Hit"); //if the ball touched the player change the state of the cell if (entity != null) { if (entity.tag == "Player" || entity.tag == "InnerGoal" || entity.tag == "Enemy") //if the cell collided with player Change the state of the cell { if (LocationOfTheCell == CellState.IsInAir || LocationOfTheCell == CellState.IsOnGround) { X8Animator = entity.gameObject.GetComponent <Animator>(); LocationOfTheCell = CellState.IsInHand; ThePlayer.PlayerBallPossessionState = BallPossessionState.HasBall; CellMoveState = CellMotionState.Neutral; //ball is in the neutral position if (ThePlayer.CheckPlayerThrowingBall()) { Debug.Log("Time is " + StateInfo.normalizedTime.ToString()); } } } } }