示例#1
0
    public override void Update()
    {
        var e = c.GetComponent <Enemy>();
        var a = c.GetComponent <Animator>();

        if (e.actionState == ActionState.Attack)
        {
            if (a.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !a.IsInTransition(0))
            {
                GetAffectedCells();

                foreach (Cell c in affectedCells)
                {
                    e.moveState   = MoveState.Move;
                    e.actionState = ActionState.Idle;
                    TicTacToeGlobal.RemoveMark(c.transform.position);
                }
            }
        }
        else
        {
            GetAffectedCells();

            if (affectedCells.FirstOrDefault(c => c.mark != null) != null)
            {
                e.moveState   = MoveState.Stop;
                e.actionState = ActionState.Attack;
                a.SetTrigger("Attack");
            }
        }
    }
示例#2
0
    public override void GetAffectedCells()
    {
        affectedCells.Clear();

        // now does not account for radius
        Cell cell = TicTacToeGlobal.GetCell(c.transform.position);
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        var  e = GetComponent <Enemy>();
        var  a = GetComponent <Animator>();
        Cell c = TicTacToeGlobal.GetCell(transform.position);

        if (e.actionState == ActionState.Attack && a.GetCurrentAnimatorStateInfo(0).normalizedTime > 1 && !a.IsInTransition(0))
        {
            e.moveState   = MoveState.Move;
            e.actionState = ActionState.Idle;
            TicTacToeGlobal.RemoveMark(transform.position);
        }

        if (c.mark != null)
        {
            if (e.actionState != ActionState.Attack)
            {
                e.moveState   = MoveState.Stop;
                e.actionState = ActionState.Attack;
                a.SetTrigger("Attack");
            }
        }
    }