コード例 #1
0
    void _Attack()
    {
        if (Enermy.State == EnermyState.Ready)
        {
            _CreateEnemy();
        }

        if (Car.Direction == Enermy.Direction)
        {
            Car.Attack();
            Enermy.PreferDie();
        }
        else
        {
            int          i   = UnityEngine.Random.Range(0, 3);
            CarDirection dir = CarDirection.Left;
            if (i == 0)
            {
                dir = CarDirection.Center;
            }
            else if (i == 1)
            {
                dir = CarDirection.Left;
            }
            else if (i == 2)
            {
                dir = CarDirection.Right;
            }

            if (dir == Car.Direction)
            {
                Enermy.Attack();
                Car.Demage();
            }

            Enermy.Move(dir);
        }
    }