Exemplo n.º 1
0
Arquivo: FSM.cs Projeto: coding137/-
    //----------------------------------------------------------------------------
    /// <summary>
    /// 타겟에게 나의 능력치를 기반하여 HP를 감소시킨다
    /// </summary>
    void Enter_AttackState()
    {
        MonsterStatus myAttribute = gameObject.GetComponent <MonsterStatus>();

        if (ProcessDeadState(myAttribute))
        {
            return;
        }

        //애니메이션 실행

        Playerstatus targetAttribute = Target.GetComponent <Playerstatus>();

        targetAttribute.current_hp -= myAttribute.damage;

        Debug.Log("Attack : " + gameObject.name + "->" + Target.name);
        Debug.Log("Hp : " + targetAttribute.current_hp.ToString());

        CharacterStateMachine targetStateMachine = Target.GetComponent <CharacterStateMachine>();

        targetStateMachine.SetState(State.DAMAGED);

        //대상이 죽은 경우는 타겟 해제
        if (targetAttribute.current_hp <= 0)
        {
            Target = null;
        }

        StartCoroutine("TransStateToIdle", myAttribute.Atk_delay);
    }
Exemplo n.º 2
0
    protected virtual void Init()
    {
        _waypoints = new List <Vector3>();
        _waypoints.Add(transform.position);
        _waypoints.Add(transform.position + (_moveDir.normalized * _moveDistance));

        _stateMachine.SetState(CharacterState.INIT_MOVE);
    }
Exemplo n.º 3
0
    protected virtual void Init()
    {
        _laserLineRenderer = GetComponentInChildren <LineRenderer>();

        _stateMachine.SetState(CharacterState.SEARCHING_FOR_TARGET);
    }