// Use this for initialization void Start() { StepManager stepManager = GameObject.FindObjectOfType <StepManager> (); stepManager.AddObserver(this); enemyController = GetComponent <PlayerControl> (); }
public void ShootArrow() { GameObject arrow = Instantiate(Resources.Load <GameObject> ("arrow")); ArrowScript arrowScript = arrow.GetComponent <ArrowScript> (); if (isFacingRight) { arrow.transform.position = shootPointRight.position; } else { arrow.transform.position = shootPointLeft.position; } Debug.Log("shoot arrow face right " + isFacingRight); arrowScript.SetDirection(isFacingRight); stepManager.AddObserver(arrowScript); stepManager.Notify(); }