Exemple #1
0
        public void Damage(float damage)
        {
            fsm.Damage(damage);
            BaseState hitState = fsm.GetStateByName("Got Hit");

            if (hitState != null)
            {
                fsm.ChangeActiveState(hitState);
            }
        }
        public void LaserAttack(AttackData attackData)
        {
            if (attackData.target != null)
            {
                AIBehaviors ai = attackData.target.GetComponent <AIBehaviors>();

                lineRenderer.positionCount = 2;
                lineRenderer.SetPosition(0, shootPoint.position);
                lineRenderer.SetPosition(1, attackData.target.position);

                hideTime = Time.time + laserVisibleDuration;
                StartCoroutine(HideRenderer());

                if (ai != null)
                {
                    ai.Damage(attackData.damage);
                }
            }
            else
            {
                Debug.LogWarning("attackData.target is null, you may want to have a NoPlayerInSight trigger on the AI '" + attackData.attackState.transform.parent.name + "'");
            }
        }