Пример #1
0
    private void Awake()
    {
        if (defaultPosition == null)
        {
            defaultPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z);
        }
        player            = GameObject.FindGameObjectWithTag("Player");
        pC                = player.GetComponent <PlayerChased>();
        destinationSetter = GetComponent <AIDestinationSetter>();
        aiPath            = GetComponent <AIPath>();

        aiPath.maxSpeed          = speed;
        destinationSetter.target = player.transform;

        if (instantChase)
        {
            AngerTrigger();
        }
        else
        {
            Idle();
        }

        Interactible interactible = GetComponent <Interactible>();

        if (interactible)
        {
            interactible.interacted += AngerTrigger;
        }
    }
Пример #2
0
    private void Awake()
    {
        sM                = GetComponent <SoundManager>();
        pC                = player.GetComponent <PlayerChased>();
        rb                = GetComponent <Rigidbody2D>();
        aiPath            = GetComponent <AIPath>();
        destinationSetter = GetComponent <AIDestinationSetter>();
        interactible      = GetComponent <Interactible>();

        interactible.interacted += AngerTrigger;

        defaultPosition = transform.position;
        Idle();
    }