public void Init()
    {
        FinalPoint           = SplineController.FinalPoint;
        ExitPoint            = SplineController.ExitPoint;
        initialFinalPointpos = FinalPoint.transform.position;
        initialExitPointPos  = ExitPoint.transform.position;
        TargetBank           = SplineController.TargetBank;
        SplineMovement.Initialize(this);
        SplineMovement.onTargetPositionReached += SetOnPositionReachedTrue;
        onBehaviorStart += SplineMovement.OnMovementStart;
        onBehaviorEnd   += SplineMovement.OnMovementEnd;
        onBehaviorStart += delegate(Effectable effectable, Vector2 vector2) { SetInitialFinalPointPosition(); };
        onBehaviorStart += StartRenderingSpline;
        onBehaviorEnd   += StopRenderingSpline;
        onBehaviorEnd   += ResetSpline;
        foreach (var effect in SplineEffect)
        {
            effect.InitEffect(SplineController);
            onBehaviorStart += effect.OnEffectStart;
            onBehaviorEnd   += effect.OnEffectEnd;
            if (effect.EffectStartsOnTargetPositionReached)
            {
                onPosReachedAttack += effect.OnEffectTrigger;
            }
            else
            {
                onConcurrentAttack += effect.OnEffectTrigger;
            }
        }

        InitEffectAnimation();
    }
示例#2
0
    //public void MoveLineInArc


    void Start()
    {
        pep          = GetComponentInChildren <ProjectileExitPoint>();
        pepTransform = pep.transform;

        LaserPointsArrayWithOrigin = new Transform[LaserPoints.Count + 1];
        for (int i = 0; i < LaserPoints.Count; i++)
        {
            if (i == 0)
            {
                LaserPointsArrayWithOrigin[0] = pepTransform;
            }

            LaserPointsArrayWithOrigin[i + 1] = LaserPoints[i];
        }


        _lineRenderer = GetComponent <LineRenderer>();
        //_lineRenderer.enabled = false;
        _lineRenderer.useWorldSpace = true;
    }