Esempio n. 1
0
    void Start()
    {
        playerTarget   = null;
        nextAttackTime = 0.0f;
        canSeePlayer   = false;
        canHearPlayer  = false;

        EnemyChildDelegate losChild = lineOfSight.AddComponent <EnemyChildDelegate>();

        losChild.Parent   = this;
        losChild.ChildTag = "LoS";

        EnemyChildDelegate earChild = hearingRadius.AddComponent <EnemyChildDelegate>();

        earChild.Parent   = this;
        earChild.ChildTag = "Ear";

        EnemyChildDelegate atkChild = attackZone.AddComponent <EnemyChildDelegate>();

        atkChild.Parent   = this;
        atkChild.ChildTag = "Atk";

        healthBar.MaxHealth = health;

        sr          = GetComponent <SpriteRenderer>();
        losCollider = lineOfSight.GetComponent <PolygonCollider2D>();

        if (!sr.flipX)
        {
            lineOfSight.transform.Rotate(0f, 0f, 180f);
            attackZone.transform.Rotate(0f, 0f, 180f);
        }
    }
Esempio n. 2
0
    void Start()
    {
        EnemyChildDelegate losChild = lineOfSight.AddComponent <EnemyChildDelegate>();

        losChild.Parent   = this;
        losChild.ChildTag = "LoS";

        EnemyChildDelegate earChild = hearingRadius.AddComponent <EnemyChildDelegate>();

        earChild.Parent   = this;
        earChild.ChildTag = "Ear";

        healthBar.MaxHealth = health;

        losCollider = lineOfSight.GetComponent <PolygonCollider2D>();
    }