Exemple #1
0
    public override void Launch(Transform from, Vector3 towards, OnLazerHit callback)
    {
        base.Launch(from, towards, callback);

        // tail width
        this.curve.MoveKey(1, new Keyframe(1f, 0f));
        this.headRenderer.widthCurve = curve;
    }
Exemple #2
0
    public override void Launch(Transform from, Vector3 towards, OnLazerHit callback)
    {
        base.Launch(from, towards, callback);

        if (this.lazerData.bounce)
        {
            this.hitPoints.Add(from.position + towards);
        }
    }
Exemple #3
0
    public virtual void Launch(Transform from, Vector3 towards, OnLazerHit callback)
    {
        base.Launch();

        this.transform.SetPositionAndRotation(from.position, from.rotation);
        this.direction  = towards.normalized;
        this.onLazerHit = callback;

        this.startTime = Time.time;
        this.headRigidbody.velocity = this.direction * this.lazerData.speed;

        this.StartAndStopCoroutine(ref this.behaviourCoroutine, this.LifeCoroutine());
    }
Exemple #4
0
    public override void Reset()
    {
        // coroutine
        this.StopAllCoroutines();

        // width
        this.ClearWidthPoint();
        this.curve.AddKey(0f, 1f);
        this.curve.AddKey(1f, 1f);
        this.headRenderer.widthCurve      = curve;
        this.headRenderer.widthMultiplier = this.lazerData.width;

        // parameter
        this.bounceCount = 0;
        this.direction   = Vector3.zero;

        // callback
        this.onLazerHit = null;

        // boolean
        this.hiting = false;
        this.dying  = false;

        // rigidbody
        this.headRigidbody.velocity = Vector3.zero;
        this.headRigidbody.transform.localPosition = Vector3.zero;
        this.headRigidbody.transform.localRotation = Quaternion.identity;
        this.headRigidbody.constraints             = RigidbodyConstraints.FreezeRotation;

        // collider
        this.headCollider.enabled = true;
        foreach (Collider c in this.ignoredCollider)
        {
            Physics.IgnoreCollision(this.headCollider, c, false);
        }
        this.ignoredCollider.Clear();

        // head
        this.headRenderer.Clear();
        this.lazerCollisionController.enabled = true;

        base.Reset();
    }