// Start is called before the first frame update
 void Start()
 {
     colorSystem = FindObjectOfType <ColorSystemOffline>().GetComponent <ColorSystemOffline>();
     lineDisplay = FindObjectOfType <LineDisplayOffline>().GetComponent <LineDisplayOffline>();
     colorSystem.movingObject = gameObject;
     if (speedControl != null)
     {
         speedControl = FindObjectOfType <SoccerSpeedControlOffline>().GetComponent <SoccerSpeedControlOffline>();
     }
 }
    // Update is called once per frame
    void Update()
    {
        try
        {
            colorSystem = FindObjectOfType <ColorSystemOffline>().GetComponent <ColorSystemOffline>();
            player      = colorSystem.newSelect.gameObject.GetComponent <Rigidbody>();
            this.gameObject.transform.position = player.position;
            //If Clicked mouse button
            if (Input.GetMouseButton(0))
            {
                //Get mouse click start position . If it is (0,0,0) . Don't show line .
                //Need to click on the object to drag and release.
                if (colorSystem.newSelect.tag == "Player" || colorSystem.newSelect.tag == "Enemy")
                {
                    if (colorSystem.newSelect.tag == "Player")
                    {
                        line.gameObject.GetComponent <LineRenderer>().colorGradient = blueTeamColor;
                    }
                    else if (colorSystem.newSelect.tag == "Enemy")
                    {
                        line.gameObject.GetComponent <LineRenderer>().colorGradient = redTeamColor;
                    }

                    MousePosition();
                    line.gameObject.SetActive(true);
                    line.SetPosition(0, transform.position);
                    //Maximum the Line Length from 5 to 27 to avoid too short or too long.
                    line.SetPosition(1, transform.position + transform.forward * Mathf.Clamp(lineLength, 5, 20));
                    //Debug.LogWarning("Line Length : " + lineLength);
                }
                else
                {
                    line.gameObject.SetActive(false);
                    return;
                }
            }
        }
        catch
        {
            //Debug uses
        }
    }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        colorSystem = FindObjectOfType <ColorSystemOffline>(); GetComponent <ColorSystemOffline>();


        continueBtn.onClick.AddListener(ClickedContinue);
        pauseBtn.onClick.AddListener(PauseMenu);
        continueGamebtn.onClick.AddListener(Continue);
        mainMenuBtn.onClick.AddListener(MainMenu);
        GoalKeeper.gameObject.SetActive(false);
        soccer.gameObject.SetActive(false);
        panel.gameObject.SetActive(false);
        if (PlayerPrefs.GetInt("Mode", 0) == 3)
        {
            skillText.text = "1";
            skillPanel.gameObject.SetActive(true);
            skillBtn.interactable = false;
            foreach (GameObject obj in GameObject.FindGameObjectsWithTag("Player"))
            {
                players.Add(obj.gameObject);
            }
            skillBtn.onClick.AddListener(BlueTeamReset);
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     dragSystem     = FindObjectOfType <DragSystemOffline>().GetComponent <DragSystemOffline>();
     ColorSystem    = FindObjectOfType <ColorSystemOffline>().GetComponent <ColorSystemOffline>();
     originPosition = gameObject.GetComponent <Transform>().localPosition;
 }