Example #1
0
    void Update()
    {
        stateMachine.Update();

        if (los.IsInSight(target))
        {
            stateMachine.Feed(Feed.EnemigoEntraEnLOS);
            _stillInSight = true;
        }

        if (!los.IsInSight(target))
        {
            _stillInSight = false;
            redLight.SetActive(false);
            stateMachine.Feed(Feed.EnemigoSaleDeLOS);
        }
    }
Example #2
0
    void Update()
    {
        stateMachine.Update();

        var distance = Vector3.Distance(transform.position, target.position);

        if (los.IsInSight(target))
        {
            stateMachine.Feed(Feed.EnemigoEntraEnLOS);

            if (distance < 1.5f)
            {
                stateMachine.Feed(Feed.EntraEnRangoDeAtaque);
                Instantiate(explosionParticle, transform.position, transform.rotation);
                Destroy(gameObject);
            }
        }

        if (!los.IsInSight(target))
        {
            stateMachine.Feed(Feed.EnemigoSaleDeLOS);
        }
    }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        stateMachine.Update();

        if (los.IsInSight(target))
        {
            if (shootState == true)
            {
                stateMachine.Feed(Feed.EnemigoEntraEnLOS);
            }
        }

        if (!los.IsInSight(target))
        {
            stateMachine.Feed(Feed.EnemigoSaleDeLOS);
            shooting.contador = 0;
        }

        if (los.IsInSight(target))
        {
            Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * 10, Color.red);
        }
    }
Example #4
0
    void Update()
    {
        if (los.IsInSight(target))
        {
            var hero = target.gameObject.GetComponent <Hero>();
            hero.Trigger("Win");
        }

        if (activateLight == true)
        {
            activateLight = false;
            greenLight.SetActive(true);
            StartCoroutine(ActivateLight());
        }
    }