/// <summary>
    /// Initializes fields.
    /// </summary>
    void Start()
    {
        seeker         = gameObject.GetComponent <Seeker>();
        aiPath         = gameObject.GetComponent <CustomAIPath>();
        spriteRenderer = gameObject.GetComponent <SpriteRenderer>();
        coll           = gameObject.GetComponent <Collider2D>();

        startingScale = transform.localScale;
        startingZPos  = GameManager.ZDepthMap.GetZDepthAtWorldPoint(transform.position);
        UpdateZPos();
    }
Exemple #2
0
    void Init()
    {
        animator     = GetComponent <Animator>();
        animOverride = animator.runtimeAnimatorController as AnimatorOverrideController;

        if (animOverride == null)
        {
            animOverride = new AnimatorOverrideController(animator.runtimeAnimatorController);
        }
        else
        {
            animOverride = new AnimatorOverrideController(animOverride);
        }

        aiPath    = GetComponent <CustomAIPath>();
        worldItem = GetComponent <WorldItem>();
    }