예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        qB_Controller = GetComponent <QB_Controller_FSM>();
        gameManager   = GameManager.Instance;

        firstStart = true;
    }
예제 #2
0
    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>();
    }
예제 #3
0
    // 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;
    }
예제 #4
0
    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));
    }
예제 #5
0
    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);
    }
예제 #6
0
    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;
    }
예제 #7
0
    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);
    }
예제 #8
0
        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();
        }
예제 #9
0
    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();
        }
    }
예제 #10
0
        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);
        }
예제 #11
0
    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();
         * }*/
    }
예제 #12
0
    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);
    }
예제 #13
0
    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;
    }
예제 #14
0
 public override void CleanUp(QB_Controller_FSM qb)
 {
     targetIndicator.gameObject.SetActive(false);
 }
예제 #15
0
 public override void CleanUp(QB_Controller_FSM qb)
 {
 }
예제 #16
0
 public override void Update(QB_Controller_FSM qb)
 {
 }
예제 #17
0
 public abstract void CleanUp(QB_Controller_FSM qb);
예제 #18
0
 public abstract void OnCollisionEnter(QB_Controller_FSM qb);
예제 #19
0
 public abstract void Update(QB_Controller_FSM qb);
예제 #20
0
 public abstract void EnterState(QB_Controller_FSM qb);
예제 #21
0
 public override void OnCollisionEnter(QB_Controller_FSM qb)
 {
 }
예제 #22
0
    IEnumerator ExecuteThrow(QB_Controller_FSM qb)
    {
        yield return(new WaitForSeconds(2));

        qb.TransitionToState(qb.throw_State);
    }
예제 #23
0
 public override void CleanUp(QB_Controller_FSM qb)
 {
     normal_img.SetActive(true);
     sacked_img.SetActive(false);
 }
예제 #24
0
 public override void EnterState(QB_Controller_FSM qb)
 {
     targetReceiver  = qb.Receiver_current.GetComponent <Receiver_Controller_FSM>();
     ball_Controller = qb.GetComponent <Ball_Controller>();
 }