// Use this for initialization void Start() { anim = GetComponent <Animator> (); //grabs the initial position of the shot InitialPos = transform.position.x; myTransform = transform; Player = GameObject.Find("Character").GetComponent <MegamanMovement>(); Buster = GameObject.Find("Character").GetComponent <WeaponsHandling>(); if (Player.FacingRight && !Player.onWall) { Right = true; } else if (!Player.FacingRight && Player.onWall && !Player.OnGround) { Right = true; } else if (Player.FacingRight && Player.OnGround && Player.onWall) { Right = true; } else { //if firing left we need to swap the sprite direction Vector3 theScale = transform.localScale; theScale.x *= -1; transform.localScale = theScale; } }
public void Start() { Player = GameObject.Find("Character").GetComponent <MegamanMovement>(); if (Path == null) { Debug.LogError("Path cannot be null", gameObject); return; } _currentPoint = Path.GetPathEnumerator(); _currentPoint.MoveNext(); if (_currentPoint.Current == null) { return; } transform.position = _currentPoint.Current.position; }