コード例 #1
0
        public override void Shoot(Aim aim, EventArgs args)
        {
            var ratio = ((IWrapper <float>)args).Value;

            damage = Mathf.Lerp(damages.x, damages.y, ratio);

            actualSpeed = Mathf.Lerp(speed, maxSpeed, ratio);
            var size = Mathf.Lerp(range.x, range.y, ratio);

            sizeTarget.localScale = Vector3.one * range.x;

            if (routine != null)
            {
                StopCoroutine(routine);
            }
            var margin = new Vector2(range.x, size);

            routine = StartCoroutine(Routines.RepeatFor(time, ratio =>
            {
                var scale             = Mathf.Lerp(margin.x, margin.y, map.Evaluate(ratio));
                sizeTarget.localScale = Vector3.one * scale;
            }, new YieldFrame()).Chain(Routines.Do(() => routine = null)));

            bounceCounter     = bounceCount;
            deactivationTimer = deactivationTime;

            base.Shoot(aim, args);
        }
コード例 #2
0
ファイル: Charger.cs プロジェクト: kirobame/Chrome-Overcoat
        protected override EventArgs OnUpdate(Aim aim, EventArgs args)
        {
            progress = Mathf.Clamp(aim.pressTime, 0.0f, time);
            HUD.Set(progress / time);

            var ratio = Mathf.InverseLerp(threshold, time, progress);

            Events.ZipCall(PlayerEvent.OnShake, shakeFactor * ratio, maxShake);

            return(args);
        }
コード例 #3
0
ファイル: Charger.cs プロジェクト: kirobame/Chrome-Overcoat
        public override void End(Aim aim, EventArgs args)
        {
            if (progress < threshold)
            {
                progress = 0.0f;
                HUD.Set(0.0f);

                return;
            }

            base.End(aim, args);
        }
コード例 #4
0
        public virtual void End(Aim aim, EventArgs args)
        {
            var modifiedArgs = OnEnd(aim, args);

            foreach (var followingPart in followingParts)
            {
                if (!followingPart.IsActive)
                {
                    continue;
                }
                followingPart.End(aim, modifiedArgs);
            }
        }
コード例 #5
0
        public override void Shoot(Aim aim, EventArgs args)
        {
            deactivationTimer = deactivationTime;
            hasHit            = false;

            base.Shoot(aim, args);

            trail.enabled = true;
            routine       = StartCoroutine(Routines.DoAfter(() =>
            {
                graph.SetActive(true);
                routine = null;
            }, 0.15f));
        }
コード例 #6
0
        protected override EventArgs OnUpdate(Aim aim, EventArgs args)
        {
            counter -= Time.deltaTime;

            if (counter <= 0)
            {
                counter = time + counter;
                foreach (var followingPart in FollowingParts)
                {
                    if (!followingPart.IsActive)
                    {
                        continue;
                    }
                    followingPart.End(aim, args);
                }
            }

            return(args);
        }
コード例 #7
0
        protected override EventArgs OnEnd(Aim aim, EventArgs args)
        {
            animator.SetTrigger("Shoot");

            var bulletPool     = Repository.Get <GenericPool>(Pool.Bullet);
            var bulletInstance = bulletPool.CastSingle <Bullet>(bullet);

            bulletInstance.Shoot(aim, args);

            if (args is IWrapper <float> forceArgs)
            {
                Events.ZipCall(PlayerEvent.OnFire, Mathf.Lerp(force * 0.25f, force, forceArgs.Value));
            }
            else
            {
                Events.ZipCall(PlayerEvent.OnFire, force);
            }

            return(args);
        }
コード例 #8
0
        protected override EventArgs OnEnd(Aim aim, EventArgs args)
        {
            var muzzleFlashPool     = Repository.Get <VfxPool>(Pool.MuzzleFlash);
            var muzzleFlashInstance = muzzleFlashPool.RequestSinglePoolable(muzzleFlash);

            if (args is IWrapper <float> sizeWrapper)
            {
                muzzleFlashInstance.transform.localScale = Vector3.one * Mathf.Lerp(0.3f, 1.0f, sizeWrapper.Value);
            }
            else
            {
                muzzleFlashInstance.transform.localScale = Vector3.one;
            }

            muzzleFlashInstance.transform.parent   = Control.Firepoint;
            muzzleFlashInstance.transform.position = aim.firepoint;
            muzzleFlashInstance.transform.rotation = Quaternion.LookRotation(aim.firingDirection);
            muzzleFlashInstance.Value.Play();

            return(args);
        }
コード例 #9
0
 protected virtual EventArgs OnEnd(Aim aim, EventArgs args) => args;
コード例 #10
0
 protected virtual EventArgs OnUpdate(Aim aim, EventArgs args) => args;
コード例 #11
0
 protected virtual EventArgs OnStart(Aim aim, EventArgs args) => args;
コード例 #12
0
ファイル: Bullet.cs プロジェクト: kirobame/Chrome-Overcoat
 public virtual void Shoot(Aim aim, EventArgs args)
 {
     transform.position = aim.firepoint;
     direction          = aim.direction.normalized;
 }
コード例 #13
0
ファイル: Charger.cs プロジェクト: kirobame/Chrome-Overcoat
 protected override EventArgs OnEnd(Aim aim, EventArgs args)
 {
     Routines.Start(CooldownRoutine());
     return(new WrapperArgs <float>(Mathf.InverseLerp(threshold, time, progress)));
 }
コード例 #14
0
 protected override EventArgs OnEnd(Aim aim, EventArgs args)
 {
     MoveControl.canShowWalk = true;
     return(args);
 }
コード例 #15
0
 public override void End(Aim aim, EventArgs args)
 {
     OnEnd(aim, args);
     return;
 }
コード例 #16
0
 protected override EventArgs OnStart(Aim aim, EventArgs args)
 {
     MoveControl.canShowWalk = false;
     return(args);
 }