// Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");


        arrow         = gameObject.GetComponent <SpriteRenderer> ();
        arrow.enabled = enableAtStart;

        if (goal.IsCheckIngredients)
        {
            // checking for ingredients
            PizzaInventory pi = player.GetComponent <PizzaInventory>();
            pi.onInventoryChange += () =>
            {
                ReallocateTarget();
            };


            ReallocateTarget();
        }
        else
        {
            currentTarget = finish.transform;
        }
    }
Пример #2
0
 void Awake()
 {
     if (pi == null)
     {
         pi = GameObject.FindGameObjectWithTag("Player").GetComponent <PizzaInventory>();
     }
 }
    void Start()
    {
        GameObject     player = GameObject.FindGameObjectWithTag("Player");
        PizzaInventory pi     = player.GetComponent <PizzaInventory>();

        pi.onPlayerDeath += () =>
        {
            StartCoroutine("WaitFunction", ResetLevelDelegate());
        };


        GameObject finish = GameObject.FindGameObjectWithTag("Finish");
        Goal       goal   = finish.GetComponent <Goal>();

        goal.onPlayerWin += () =>
        {
            StartCoroutine("WaitFunction", LoadNextSceneDelegate());
        };
    }