Exemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     colorSystem              = FindObjectOfType <ColorSystem>().GetComponent <ColorSystem>();
     speedControl             = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
     controllPoint            = FindObjectOfType <ControlPoint>().GetComponent <ControlPoint>();
     colorSystem.movingObject = gameObject;
     rb = gameObject.GetComponent <Rigidbody>();
 }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     try
     {
         turnMenu    = FindObjectOfType <TurnMenu>().GetComponent <TurnMenu>();
         turnCounter = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>();
         ballSpeed   = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
     }
     catch (Exception e)
     {
         //Avoid crash
     }
 }
Exemplo n.º 3
0
 private void Start()
 {
     try
     {
         goalText = FindObjectOfType <GoalTextOnline>().GetComponent <GoalTextOnline>();
         counter  = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>();
         soccer   = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
     }
     catch (Exception e)
     {
         //Avoid crash
     }
     //Debug data remove
     //PlayerPrefs.DeleteAll();
 }
Exemplo n.º 4
0
 private void Update()
 {
     if (goalText == null || counter == null || soccer == null)
     {
         try
         {
             goalText = FindObjectOfType <GoalTextOnline>().GetComponent <GoalTextOnline>();
             counter  = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>();
             soccer   = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
         }
         catch (Exception e)
         {
             //Avoid crash
         }
     }
 }
Exemplo n.º 5
0
 // Update is called once per frame
 void Update()
 {
     team1ScoreText.text = counter.teamBlueScores.ToString();
     team2ScoreText.text = counter.teamRedScores.ToString();
     scoreText1.text     = TeamName;
     scoreText2.text     = Message;
     if (scoresPanel)
     {
         scoreText1.gameObject.SetActive(true);
         scoreText2.gameObject.SetActive(true);
     }
     else
     {
         scoreText1.gameObject.SetActive(false);
         scoreText2.gameObject.SetActive(false);
     }
     if (soccer == null)
     {
         soccer = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
     }
 }
Exemplo n.º 6
0
 private void Update()
 {
     if (turnCounter == null || turnMenu == null || ballSpeed == null)
     {
         try
         {
             turnCounter = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>();
             turnMenu    = FindObjectOfType <TurnMenu>().GetComponent <TurnMenu>();
             ballSpeed   = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
         }
         catch (Exception e)
         {
             //Debug.
         }
     }
     if (turnCounter != null)
     {
         if (turnCounter.Shot == true)
         {
             updates();
         }
     }
 }
Exemplo n.º 7
0
    //[Command(ignoreAuthority = true)]
    ////Call from client, run it on server
    //private void CmdControlSpeed(float SpeedLimit)
    //{

    //    RpcControlSpeed(SpeedLimit);
    //}

    //[ClientRpc]
    //void RpcControlSpeed(float SpeedLimit)
    //{
    //    #region SpeedLimit Script
    //    //Speed Limit
    //    //If the speed is faster than 120, than limit the speed.
    //    try
    //    {
    //        if (SpeedLimit > 120f)
    //        {
    //            //Limit speed to 120 maximum.
    //            rb.velocity = rb.velocity.normalized * 120f;
    //        }

    //        //If the player is moving Very low then Stop
    //        if (SpeedLimit <= 1f)
    //        {
    //            //Debug.Log("Stopping Object");
    //            rb.velocity = Vector3.zero;
    //        }
    //    }
    //    catch(Exception ex)
    //    {
    //        Debug.LogWarning($"Control Speed Function error: {ex}");
    //    }

    //    #endregion
    //}

    //private void ControlSpeed()
    //{
    //    float Speed = rb.velocity.magnitude;
    //    CmdControlSpeed(Speed);
    //}
    #endregion

    // Update is called once per frame
    void Update()
    {
        //if (rb.gameObject.tag == "Player" || rb.gameObject.tag == "Enemy")
        //{
        //    if (GameObject.FindGameObjectsWithTag("Enemy").Length != 0 && GameObject.FindGameObjectsWithTag("Player").Length != 0)
        //        ControlSpeed();
        //}


        try
        {
            turnCounter  = FindObjectOfType <TurnCounter>().GetComponent <TurnCounter>();
            speedControl = FindObjectOfType <SoccerSpeedControl>().GetComponent <SoccerSpeedControl>();
        }
        catch (Exception ex)
        {
        }

        if (((gameObject.tag == "Player" && isServer && isClient) || (gameObject.tag == "Enemy" && isClientOnly)) && speedControl != null)
        {
            DragAndShoot();
        }
        //ControlSpeed();
    }