Exemple #1
0
    // Use this for initialization
    void Start()
    {
        StepManager stepManager = GameObject.FindObjectOfType <StepManager> ();

        stepManager.AddObserver(this);
        enemyController = GetComponent <PlayerControl> ();
    }
Exemple #2
0
    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();
    }