void Awake()
    {
        msControl = GetComponent <MovementControl>();
        msControl.UpdateStateInfo(MovementControl.MovementState.STOP);
        team = gameObject.tag;

        backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        backgroundTexture.SetPixel(0, 0, Color.black);
        backgroundTexture.Apply();

        healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        healthTexture.SetPixel(0, 0, Color.green);
        healthTexture.Apply();
    }
    // Use this for initialization
    void Start()
    {
        msControl = GetComponent <MovementControl>();
        UpdateStatistics(new BaseUnit("Minion", transform, "Minion", 250.0, 15, 0, 50, 9, 0.75f, 0f, 20, 5, 0, 2, 2, 2, 0f, 0f, 0f, 0f),
                         new List <Vector3> {
            new Vector3(15, 0, 0), new Vector3(10, 0, 0), new Vector3(-20, 0, 0)
        });
        msControl.UpdateStateInfo(MovementControl.MovementState.ATTACKMOVE);
        team = gameObject.tag;

        backgroundTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        backgroundTexture.SetPixel(0, 0, Color.black);
        backgroundTexture.Apply();

        healthTexture = new Texture2D(1, 1, TextureFormat.RGB24, false);
        healthTexture.SetPixel(0, 0, Color.green);
        healthTexture.Apply();
    }
    // Update is called once per frame
    void Update()
    {
        if (PhotonNetwork.isMasterClient)
        {
            if (waypoints.Count > 0)
            {
                msControl.UpdateMovementInformation(MovementControl.MovementState.ATTACKMOVE, transform, waypoints[0]);
                if (msControl.OnApproach())
                {
                    waypoints.RemoveAt(0);
                }
            }
            else
            {
                msControl.UpdateStateInfo(MovementControl.MovementState.STOPATTACK);
            }

            if (minionInfo.Dead)
            {
                PhotonNetwork.Destroy(gameObject);
            }
        }
    }