コード例 #1
0
ファイル: LazerShot.cs プロジェクト: Hugoruberte/OUTERSNAKE
    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;
    }
コード例 #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);
        }
    }
コード例 #3
0
ファイル: Lazer.cs プロジェクト: Hugoruberte/OUTERSNAKE
    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());
    }
コード例 #4
0
ファイル: Lazer.cs プロジェクト: Hugoruberte/OUTERSNAKE
    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();
    }