// Start is called before the first frame update void Start() { qB_Controller = GetComponent <QB_Controller_FSM>(); gameManager = GameManager.Instance; firstStart = true; }
void Awake() { myRb = GetComponent <Rigidbody2D>(); ballGo = GameObject.Find("Ball"); ball_controller = GameObject.Find("QB").GetComponent <Ball_Controller>(); qB_Controller = GameObject.Find("QB").GetComponent <QB_Controller_FSM>(); }
// Start is called before the first frame update void Start() { qB_Controller = GetComponent <QB_Controller_FSM>(); gameManager = GameManager.Instance; //register yourself with the GameManager gameManager.passAgent = this; firstStart = true; }
public override void EnterState(QB_Controller_FSM qb) { //for now just a hacky, random version int receiverIndex = Random.Range(0, qb.Receivers.Length); qb.Receiver_current = qb.Receivers[receiverIndex]; qb.StartCoroutine(ExecuteThrow(qb)); }
public override void EnterState(QB_Controller_FSM qb) { GameObject normal_img = qb.transform.Find("Img_normal").gameObject; normal_img.SetActive(false); GameObject sacked_img = qb.transform.Find("Img_sacked").gameObject; sacked_img.SetActive(true); }
public override void EnterState(QB_Controller_FSM qb) { normal_img = qb.transform.Find("Img_normal").gameObject; sacked_img = qb.transform.Find("Img_sacked").gameObject; normal_img.SetActive(false); sacked_img.SetActive(true); GameManager.Instance.qbSacked = true; }
void Awake() { myRb = GetComponent <Rigidbody2D>(); ball_controller = GameObject.Find("QB").GetComponent <Ball_Controller>(); qB_Controller = GameObject.Find("QB").GetComponent <QB_Controller_FSM>(); ball_controller.ballAwarePlayers.Add(this); }
void Awake() { myRb = GetComponent <Rigidbody2D>(); ball_controller = GameObject.Find("QB").GetComponent <Ball_Controller>(); qB_Controller = GameObject.Find("QB").GetComponent <QB_Controller_FSM>(); ball_controller.ballAwarePlayers.Add(this); //get random skills for this player //SetRandomSkill(); SetMaxSkill(); }
public override void Update(QB_Controller_FSM qb) { if (targetIndicator == null) { targetIndicator = qb.InstantiateTargetIndicator(CalcTarget(qb)); } targetIndicator.position = CalcTarget(qb); if (Input.GetKeyDown(KeyCode.Space)) { ball_Controller.target = targetIndicator; ball_Controller.Launch(); } }
void Awake() { myRb = GetComponent <Rigidbody2D>(); ball_controller = GameObject.Find("QB").GetComponent <Ball_Controller>(); qB_Controller = GameObject.Find("QB").GetComponent <QB_Controller_FSM>(); ball_controller.ballAwarePlayers.Add(this); //get random skills for this player speed = Random.Range(2.5f, 4.5f); reactionDelay = Random.Range(0.2f, 1.5f); }
public override void Update(QB_Controller_FSM qb) { //for ml this mechanism is changed. We throw emediatly after entering this state /*if(targetIndicator == null) * { * targetIndicator = qb.InstantiateTargetIndicator(CalcTarget(qb)); * } * targetIndicator.position = CalcTarget(qb); * * if(Input.GetKeyDown(KeyCode.Space)) * { * ball_Controller.target = targetIndicator; * ball_Controller.Launch(); * }*/ }
public Vector2 CalcTarget(QB_Controller_FSM qb) { //create the target on the current RouteVEctor - it might not fit onto it Vector2 dir = targetReceiver.currentRoute.peakCurrentRoutePoint().normalized *qb.targetOffset; Vector2 target = (Vector2)targetReceiver.transform.position + dir; if ((targetReceiver.currentTarget - (Vector2)targetReceiver.transform.position).magnitude < qb.targetOffset) //if((targetReceiver.currentTarget - target).magnitude < targetThreshold) { //Target doesnt fit on current vector //so now the we need to consider the position of the receiver float distToEdge = qb.targetOffset - (targetReceiver.currentTarget - (Vector2)targetReceiver.transform.position).magnitude; dir = targetReceiver.currentRoute.peakNextRoutePoint().normalized *distToEdge; target = targetReceiver.currentTarget + dir; } return(target); }
public override void EnterState(QB_Controller_FSM qb) { targetReceiver = qb.Receiver_current.GetComponent <Receiver_Controller_FSM>(); ball_Controller = qb.GetComponent <Ball_Controller>(); //this is so that we throw imedialty when we enter the state if (targetIndicator == null) { targetIndicator = qb.InstantiateTargetIndicator(CalcTarget(qb)); } else { targetIndicator.gameObject.SetActive(true); targetIndicator.position = CalcTarget(qb); } ball_Controller.target = targetIndicator; ball_Controller.Launch(); GameManager.Instance.ballLaunched = true; }
public override void CleanUp(QB_Controller_FSM qb) { targetIndicator.gameObject.SetActive(false); }
public override void CleanUp(QB_Controller_FSM qb) { }
public override void Update(QB_Controller_FSM qb) { }
public abstract void CleanUp(QB_Controller_FSM qb);
public abstract void OnCollisionEnter(QB_Controller_FSM qb);
public abstract void Update(QB_Controller_FSM qb);
public abstract void EnterState(QB_Controller_FSM qb);
public override void OnCollisionEnter(QB_Controller_FSM qb) { }
IEnumerator ExecuteThrow(QB_Controller_FSM qb) { yield return(new WaitForSeconds(2)); qb.TransitionToState(qb.throw_State); }
public override void CleanUp(QB_Controller_FSM qb) { normal_img.SetActive(true); sacked_img.SetActive(false); }
public override void EnterState(QB_Controller_FSM qb) { targetReceiver = qb.Receiver_current.GetComponent <Receiver_Controller_FSM>(); ball_Controller = qb.GetComponent <Ball_Controller>(); }