예제 #1
0
 void OnShootFinished(bool isGoal, Area area)
 {
     RunAfter.runAfter(gameObject, () =>
     {
         DemoShoot.share.Reset(RandomNewPos);
     }, resetAfter);
 }
예제 #2
0
    void NextTurn()
    {
        if (_count / 2 >= maxTurn)
        {
            Finalize();
        }
        else
        {
            textCountTurn.text = (_count / 2 + 1).ToString();

            if (_count % 2 == 0)       // even turn is my turn to shoot
            {
                //Voi shut phat goc, do vi tri Camera reset khong phu thuoc vao vi tri Ball -> Dat switch Camera len dau
                SwitchCamera.share.setActiveCamera("CornerCamera"); //Maicamera se move theo vi tri cua Ball -> Chuyen ve phat goc
                //Do khi da phat goc, bong reset ve vi tri goc san nen phai goi ham Reset lien quan Goal Keeper truoc, ko se bi an theo bong
                GoalKeeperHorizontalFly.share.reset();              //Reset Goalkeeper ve vi tri o giua khung thanh
                GoalKeeper.share.reset();
                textCountTurn.text = "Trong ham count%2=0 shut goc";
                GoalKeeperHorizontalFly.share.IsAIControl = true;
                ShootAI.shareAI.willBeShootByUser         = false;
                //GoalKeeperHorizontalFly.share.IsAIControl = true;
                //ShootAI.shareAI.willBeShootByUser = false;
                //SwitchCamera.share.OnToggle_BeGoalKeeper(false);
                ShootCorner.shareCorner.cornerReset(); //Goi ham reset vi tri cua Ball ve goc trai khung thanh

                GoalDetermine.share.reset();           //Reset lai tinh toan Goal

                CameraManager.share.reset();           //Reset vi tri va goc tuong ung cho Camera Corner va Main, Back Camera
                SlowMotion.share.reset();
                //Goi ham sut phat goc
                RunAfter.runAfter(gameObject, () =>
                {
                    //Khi goi ham sut phat goc, se goi ca ham dieu chinh camera doi theo goc sut bong
                    ShootCorner.shareCorner.cornerShoot();
                }, shootAfter);
                // reset camera position
                // CameraManager.share.reset();
                //Set Main Camera Active
                //SwitchCamera.share.IsFront = true;
            }
            else        //  odd turn is AI turn to shoot
            {
                textCountTurn.text = "Shut AI";
                GoalKeeperHorizontalFly.share.IsAIControl = false;
                //Can reset bong ve vi tri truoc cau mon
                ShootAI.shareAI.reset();                          //Ham nay chi reset vi tri cua Ball truoc cau mon cua Shoot AI
                GoalKeeperHorizontalFly.share.reset();            //Reset Goalkeeper ve vi tri o giua khung thanh
                GoalKeeper.share.reset();
                GoalDetermine.share.reset();                      //Reset lai tinh toan Goal
                SwitchCamera.share.setActiveCamera("CameraMain"); //Set Main Camera Active
                CameraManager.share.reset();                      //Reset vi tri va goc tuong ung cho Camera Corner va Main, Back Camera

                //Can ham reset camera theo vi tri moi cua Ball

                // SwitchCamera.share.IsFront = false;
                RunAfter.runAfter(gameObject, DoShootAI, 3f);
            }
        }
    }
예제 #3
0
 void OnNewTurn()
 {
     if (AutoShoot)
     {
         RunAfter.runAfter(gameObject, () =>
         {
             ShootAI.shareAI.shoot();
         }, shootAfter);
     }
 }
예제 #4
0
    public void Reset(bool shouldRandomNewPos)
    {
        // ShootAI reset logic must be called first, to reset new ball poosition, reset() method of other components must come after this
        if (shouldRandomNewPos)
        {
            ShootAI.shareAI.reset();                // used this method to reset new randomised ball's position
        }
        else
        {
            ShootAI.shareAI.reset(ShootAI.shareAI.BallPositionX, ShootAI.shareAI.BallPositionZ);        // call like this to reset new turn with current ball position
        }
        //HENRY CLOSE
        SlowMotion.share.reset();                   // reset the slowmotion logic

        GoalKeeperHorizontalFly.share.reset();      // reset ve vi tri giua goal sau moi luot sut .goalkeeperhorizontalfly logic
        GoalKeeper.share.reset();                   // reset goalkeeper logic
        GoalDetermine.share.reset();                // reset goaldetermine logic so that it's ready to detect new goal

        /*
         * if (Wall.share != null)                     // if there is wall in this scene
         * {
         *  Wall.share.IsWall = IsWallKick;         // set is wall state
         *  if (IsWallKick)                         // if we want wall kick
         *      Wall.share.setWall(Shoot.share._ball.transform.position);       // set wall position with respect to ball position
         * }
         */


        //Test autoshoot
        //Put Ball to the corner
        //yield return new WaitForEndOfFrame();       // wait for the execution of Start method of DemoShoot

        //GKHorizontalFlyDebug.share.OnToggle_BeGoalKeeper(true);
        //SwitchCamera.share.OnToggle_BeGoalKeeper(true);
        // Use this for initialization
        //Remove de dam bao camera keep duoc ball
        //RunAfter.removeTasks(gameObject);
        //De enable shoot by AI: willBeShootByUser = false, IsAIControl = false, _isShootByAI = true, _isShooting = true
        ShootAI.shareAI.willBeShootByUser = false;
        //GoalKeeperHorizontalFly.share.IsAIControl = true;
        //ShootAI.shareAI.willBeShootByUser = false;
        //SwitchCamera.share.OnToggle_BeGoalKeeper(false);
        ShootCorner.shareCorner.cornerReset();
        RunAfter.runAfter(gameObject, () =>
        {
            ShootCorner.shareCorner.cornerShoot();
        }, shootAfter);
        // reset camera position
        CameraManager.share.reset();
    }
예제 #5
0
    private void EventShootFinish(bool isGoal, Area area)
    {
        if (isGoal)
        {
            if (_count % 2 == 0)
            {
                ++CountGoalMe;
            }
            else
            {
                ++CountGoalAi;
            }
        }

        ++_count;
        RunAfter.runAfter(gameObject, NextTurn, 2f);
    }
예제 #6
0
 void NextTurn()
 {
     if (_count / 2 >= maxTurn)
     {
         Finalize();
     }
     else
     {
         textCountTurn.text = (_count / 2 + 1).ToString();
         Reset();
         if (_count % 2 == 0)       // even turn is my turn to shoot
         {
             GoalKeeperHorizontalFly.share.IsAIControl = true;
             SwitchCamera.share.IsFront = true;
         }
         else        //  odd turn is AI turn to shoot
         {
             GoalKeeperHorizontalFly.share.IsAIControl = false;
             SwitchCamera.share.IsFront = false;
             RunAfter.runAfter(gameObject, DoShootAI, 2f);
         }
     }
 }