コード例 #1
0
    public override void OnEnter()
    {
        eventHandler.OnCustomAnimationEvent += OnCustomEvent;
        controller.ClearVelocity();
        controller.ActiveGravity = false;

        target = Owner.GetComponent <NodeCanvas.Framework.Blackboard> ().GetValue <Transform> ("Target");

        currentCount = 0;

        var hit = Physics2D.Raycast(target.position, Vector2.down, float.MaxValue, LayerMask.GetMask("Platform", "OneWayPlatform", "Wall"));

        if (hit.collider != null)
        {
            heightY    = hit.collider.bounds.max.y + height;
            rangeLeft  = target.position.x - range * 0.5f;
            rangeRight = target.position.x + range * 0.5f;
            AIUtils.ClampPlatformEdgePoint(hit.collider, ref rangeLeft, ref rangeRight);
        }
        else
        {
            Debug.LogError($"Action_Boss08_Atk3_Teleport没找到平台");
        }

        // 状态起始先传送一下
        Owner.transform.SetPosition(Random.Range(rangeLeft, rangeRight), heightY);
    }
コード例 #2
0
        public override void OnEnter()
        {
            target = blackboard.GetValue <Transform> ("Target");

            _dashDuration = Random.Range(dashDurationMin, dashDurationMax);
            _timer        = 0f;

            var dir = AIUtils.GetTargetDirectionRelative(target.position, Owner.transform.position);

            if (TowardTarget)
            {
                _dashDirection = dir;
            }
            else
            {
                _dashDirection = -dir;
            }

            if (FaceDirection == 1)
            {
                faceDirectionComponent.SetFaceDirection(dir);
            }
            if (FaceDirection == -1)
            {
                faceDirectionComponent.SetFaceDirection(-dir);
            }

            platformController.ClearVelocity();
            platformController.ActiveGravity = false;
        }
コード例 #3
0
 public override void OnEnter()
 {
     eventHandler.OnCustomAnimationEvent += OnCustomEvent;
     controller.ClearVelocity();
     controller.ActiveGravity = false;
     isJumpBack = false;
 }