void FlameOnDelegate(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNumber)
    {
        if(clip.GetFrame(frameNumber).eventInfo.Equals("FlameOn"))
        {
            string fireTag = fireHitObject.tag;

            if (fireTag.Equals("Throwable"))
            {
                Vector3 position = fireHitObject.transform.position;
                position.z = charcoalParticleEffect.transform.position.z;

                // KILL THE PEASANTS
                Destroy(fireHitObject);

                // BURNINATE THE PEASANTS (particle effects)
                ParticleSystem localCharcoal = GameObject.Instantiate(charcoalParticleEffect, position, charcoalParticleEffect.transform.rotation) as ParticleSystem;
                localCharcoal.Play();
            }
            else if (fireTag.Equals("Player"))
            {
                // TODO: tell player to get bumped
            }
        }

        if(clip.GetFrame(frameNumber).eventInfo.Equals("DragonFootStep"))
        {
            AudioSource.PlayClipAtPoint(footSteps[Random.Range( 0, footSteps.Count )], transform.position);
        }
    }
Пример #2
0
        private void OnAnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIndex)
        {
            animator.AnimationEventTriggered -= OnAnimationEventTriggered;

            tk2dSpriteAnimationFrame frame = clip.GetFrame(frameIndex);

            if (frame.eventInfo == AnimationTriggerDefs.SkillApply.ToString())
            {
                if (owner.componentsHolder.transform.localScale.x > 0f)
                {
                    skillUIElement.Apply(owner, data, Mathf.PI);
                }
                else
                {
                    skillUIElement.Apply(owner, data, 0);
                }

                GhostEffectScript ghost = skillUIElement.GetComponent <GhostEffectScript>();
                ghost.StartEffect();

                skillUIElement.OnDestroyed = () =>
                {
                    skillUIElement = null;

                    Destroy(this);
                };
            }
        }
 public void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame)
 {
     if (m_state == DashState.Dash && m_shouldFire && clip.GetFrame(frame).eventInfo == "fire")
     {
         Fire();
     }
 }
Пример #4
0
    // Callbacks
    void AnimationEventCallback(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNo)
    {
        var frame = clip.GetFrame(frameNo);

#if DEBUG_ANIMATION
        Debug.Log("Animation Trigger Check: " + frame.eventInfo + " Clip Name: " + clip.name + " Frame No: " + frameNo);
#endif

        switch (frame.eventInfo)
        {
        case "SWING_SET":
            isSwinging = true;
            break;

        case "SWING_UNSET":
            isSwinging = false;
            mySlashL.SetActive(false);
            mySlashR.SetActive(false);
            break;

        case "LEAP":
            // At the start of the leap, Allow Questio to switch animations (mid frame) if the player got to his other side.
            UpdateFacing();
            if (IsFacingLeft)
            {
                if (clip.name != "swingL")
                {
                    myAnim.PlayFromFrame("swingL", frameNo + 1);
                }
            }
            else
            {
                if (clip.name != "swingR")
                {
                    myAnim.PlayFromFrame("swingR", frameNo + 1);
                }
            }

            Leap();
            break;

        case "SWING_FINISHED":
            mySlashL.SetActive(false);
            mySlashR.SetActive(false);
            if (!isDazed)
            {
                myAnim.Play("idle");
                fp.enabled = true;
            }
            SwingFinished();
            UpdateFacing();
            break;

        default:
#if DEBUG_ANIMATION
            Debug.Log("Animation Trigger Not Found: " + frame.eventInfo);
#endif
            break;
        }
    }
		void AnimationEventDelegate (tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip, int frameNum)
		{
			tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNum);
			Fsm.EventData.IntData = frame.eventInt;
			Fsm.EventData.StringData = frame.eventInfo;
			Fsm.EventData.FloatData = frame.eventFloat;
			Fsm.Event(animationTriggerEvent);
		}
Пример #6
0
        void AnimationEventDelegate(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip, int frameNum)
        {
            tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNum);

            Fsm.EventData.IntData    = frame.eventInt;
            Fsm.EventData.StringData = frame.eventInfo;
            Fsm.EventData.FloatData  = frame.eventFloat;
            Fsm.Event(animationTriggerEvent);
        }
        private void HandleSurpriseChestAnimationEvent(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNo)
        {
            tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNo);

            if (frame.eventInfo == "coopchestvfx")
            {
                Instantiate(BraveResources.Load("Global VFX/VFX_ChestKnock_001", ".prefab"), sprite.WorldCenter + new Vector2(0f, 0.3125f), Quaternion.identity);
            }
        }
        private void HandleAnimationEvent(tk2dSpriteAnimator arg1, tk2dSpriteAnimationClip arg2, int arg3)
        {
            tk2dSpriteAnimationFrame frame = arg2.GetFrame(arg3);

            if (frame.eventInfo == "fire")
            {
                this.SpawnProjectiles();
            }
        }
 public void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIdx)
 {
     if (clip.GetFrame(frameIdx).eventInfo == "damageEnemies" && this.Player != null && this.Player.PlayerHasActiveSynergy("#GRIM_SUPERREAPER"))
     {
         GameObject obj = SpawnManager.SpawnVFX(ResourceCache.Acquire("Global VFX/VFX_Curse") as GameObject, gun.sprite.WorldCenter, Quaternion.identity);
         obj.GetComponent <tk2dBaseSprite>().PlaceAtPositionByAnchor(gun.sprite.WorldCenter, tk2dBaseSprite.Anchor.LowerCenter);
         obj.GetComponent <tk2dBaseSprite>().renderer.material.shader = ShaderCache.Acquire("Brave/LitCutoutUberPhantom");
         GameManager.Instance.StartCoroutine(this.DelayedDamageToEnemy());
     }
 }
Пример #10
0
    void AnimationEventHandler(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNum)
    {
        //string str = animator.name + "\n" + clip.name + "\n" + "INFO: " + clip.GetFrame(frameNum).eventInfo;
        string eventInfo = clip.GetFrame(frameNum).eventInfo;

        if (eventInfo == "Attack Hit")
        {
            CheckRange();
        }
    }
Пример #11
0
 private void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame)
 {
     if (clip.GetFrame(frame).eventInfo == "guntoggle")
     {
         this.thisWesternBro.aiShooter.ToggleGunAndHandRenderers(true, rendererReason);
         foreach (var bro in otherWesternBros)
         {
             bro.aiShooter.ToggleGunAndHandRenderers(true, rendererReason);
         }
     }
 }
Пример #12
0
        private void AnimationEventDelegate(tk2dSpriteAnimator anim, tk2dSpriteAnimationClip clip, int frameNum)
        {
            if (clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Loop && clip.name != _storedClip ||
                clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.LoopSection && clip.name != _storedClip ||
                clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Once)
            {
                _storedClip = clip.name;
                tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNum);

                string clipName = frame.eventInfo;
                ClientSend.EnemyAnimation(clipName);
            }
        }
Пример #13
0
 void OnAnimEvent(tk2dSpriteAnimator aAnim, tk2dSpriteAnimationClip aClip, int frame)
 {
     if (anim == aAnim && aClip == mClips[(int)AnimState.attack])
     {
         tk2dSpriteAnimationFrame frameDat = aClip.GetFrame(frame);
         if (frameDat.eventInfo == "actS")
         {
             mActActive = true;
         }
         else if (frameDat.eventInfo == "actE")
         {
             mActActive = false;
         }
     }
 }
        private void OnAnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIndex)
        {
            animator.AnimationEventTriggered -= OnAnimationEventTriggered;

            tk2dSpriteAnimationFrame frame = clip.GetFrame(frameIndex);

            if (frame.eventInfo == AnimationTriggerDefs.SkillApply.ToString())
            {
                skillUIElement.Apply(owner, data, targetPosition);

                skillUIElement = null;

                Destroy(this);
            }
        }
Пример #15
0
        private void AnimationEventDelegate(tk2dSpriteAnimator anim, tk2dSpriteAnimationClip clip, int frameNum)
        {
            if (clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Loop && clip.name != _storedClip ||
                clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.LoopSection && clip.name != _storedClip ||
                clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Once)
            {
                _storedClip = clip.name;
                tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNum);

                string clipName = frame.eventInfo;
                foreach (byte player in SessionManager.Instance.Players.Keys)
                {
                    ClientSend.EnemyAnimation(player, clipName, enemyId);
                }
            }
        }
Пример #16
0
    // Callbacks
    void AnimationEventCallback(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNo)
    {
        var frame = clip.GetFrame(frameNo);

        Debug.Log("Animation Trigger Check: " + frame.eventInfo);
        switch (frame.eventInfo)
        {
        case "CAST_FINISHED":
            myAnim.Play("idle");
            break;

        default:
            Debug.Log("Animation Trigger Not Found: " + frame.eventInfo);
            break;
        }
    }
Пример #17
0
        private void AnimationEventDelegate(tk2dSpriteAnimator anim, tk2dSpriteAnimationClip clip, int frameNum)
        {
            if (clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Loop && clip.name != _storedClip ||
                clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.LoopSection && clip.name != _storedClip ||
                clip.wrapMode == tk2dSpriteAnimationClip.WrapMode.Once)
            {
                _storedClip = clip.name;
                tk2dSpriteAnimationFrame frame = clip.GetFrame(frameNum);

                string clipName = frame.eventInfo;
                //ServerSend.EnemyAnimation(clipName);
                foreach (byte player in playerIds)
                {
                    ServerSend.EnemyAnimation(player, clipName, enemyId);
                }
            }
        }
Пример #18
0
        private void OnAnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIndex)
        {
            animator.AnimationEventTriggered -= OnAnimationEventTriggered;

            tk2dSpriteAnimationFrame frame = clip.GetFrame(frameIndex);

            if (frame.eventInfo == AnimationTriggerDefs.SkillApply.ToString())
            {
                Vector3 startPoint = this.skillUIElement.transform.position;

                float degree = Mathf.Atan2(targetPosition.y - startPoint.y, targetPosition.x - startPoint.x) * Mathf.Rad2Deg;

                float angle = degree * Mathf.Deg2Rad;

                this.skillUIElement.Apply(owner, data, angle);

                for (int index = 0; index < shotAmount; index++)
                {
                    SkillUI skillUIElement = ResourceUtils.AddAndGetComponent <SkillUI>(GlobalDefinitions.RESOURCE_PATH_SKILL + data.resourceID);
                    skillUIElement.transform.SetParent(owner.componentsHolder.transform);
                    skillUIElement.IgnoreCollisionMap(true);
                    skillUIElement.transform.position   = startPoint;
                    skillUIElement.transform.localScale = Vector2.one;
                    angle = (degree - shotDegree * (index + 1)) * Mathf.Deg2Rad;
                    skillUIElement.Apply(owner, data, angle);
                }

                for (int index = 0; index < shotAmount; index++)
                {
                    skillUIElement = ResourceUtils.AddAndGetComponent <SkillUI>(GlobalDefinitions.RESOURCE_PATH_SKILL + data.resourceID);
                    skillUIElement.transform.SetParent(owner.componentsHolder.transform);
                    skillUIElement.IgnoreCollisionMap(true);
                    skillUIElement.transform.position   = startPoint;
                    skillUIElement.transform.localScale = Vector2.one;
                    angle = (degree + shotDegree * (index + 1)) * Mathf.Deg2Rad;
                    skillUIElement.Apply(owner, data, angle);
                }

                Destroy(this);

                this.skillUIElement = null;
            }
        }
 // Token: 0x06004875 RID: 18549 RVA: 0x001A439C File Offset: 0x001A259C
 public void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame)
 {
     if (this.m_shouldFire && clip.GetFrame(frame).eventInfo == "fire")
     {
         if (this.State == TeleportToListOfAreasBehavior.TeleportState.TeleportIn)
         {
             SpawnManager.SpawnBulletScript(this.m_aiActor, this.teleportInBulletScript, null, null, false, null);
         }
         else if (this.State == TeleportToListOfAreasBehavior.TeleportState.TeleportOut)
         {
             SpawnManager.SpawnBulletScript(this.m_aiActor, this.teleportOutBulletScript, null, null, false, null);
         }
         this.m_shouldFire = false;
     }
     else if (this.State == TeleportToListOfAreasBehavior.TeleportState.TeleportOut && clip.GetFrame(frame).eventInfo == "teleport_collider_off")
     {
         this.m_aiActor.specRigidbody.CollideWithOthers = false;
         this.m_aiActor.IsGone = true;
     }
 }
        public static void PlayReversed(this tk2dSpriteAnimator anim, string clipName, float fps = 12)
        {
            IEnumerator PlayReversed()
            {
                anim.Stop();

                tk2dSpriteAnimationClip clip = anim.GetClipByName(clipName);

                tk2dSpriteAnimationFrame[] frames = clip.frames;
                int numFrames = frames.Length;
                tk2dSpriteCollectionData collectionData = clip.GetFrame(0).spriteCollection;

                for (int frame = numFrames - 1; frame >= 0; frame--)
                {
                    int spriteId = frames[frame].spriteId;
                    anim.SetSprite(collectionData, spriteId);
                    yield return(new WaitForSeconds(1.0f / fps));
                }
            }

            anim.StartCoroutine(PlayReversed());
        }
        private void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frame)
        {
            if (clip.GetFrame(frame).eventInfo == "slam")
            {
                GameManager.Instance.MainCameraController.DoScreenShake(SlamScreenShakeSettings, (transform.position + new Vector3(0, 2f)), false);

                if (ImpactVFXObjects != null && ImpactVFXObjects.Length > 0)
                {
                    float SpawnPositionX  = UnityEngine.Random.Range((transform.position.x + 2), (transform.position.x + 3));
                    float SpawnPositionY  = UnityEngine.Random.Range((transform.position.y + 2), (transform.position.y + 9));
                    float SpawnPositionX2 = UnityEngine.Random.Range((transform.position.x + 2), (transform.position.x + 3));
                    float SpawnPositionY2 = UnityEngine.Random.Range((transform.position.y + 2), (transform.position.y + 9));

                    Vector3 SpawnPosition  = new Vector3(SpawnPositionX, SpawnPositionY);
                    Vector3 SpawnPosition2 = new Vector3(SpawnPositionX2, SpawnPositionY2);

                    Instantiate(BraveUtility.RandomElement(ImpactVFXObjects), SpawnPosition, Quaternion.identity);

                    if (BraveUtility.RandomBool())
                    {
                        Instantiate(BraveUtility.RandomElement(ImpactVFXObjects), SpawnPosition2, Quaternion.identity);
                    }

                    List <string> SoundFXList = new List <string>()
                    {
                        "Play_OBJ_rock_break_01", "Play_OBJ_boulder_crash_01", "Play_OBJ_stone_crumble_01"
                    };
                    SoundFXList = SoundFXList.Shuffle();
                    AkSoundEngine.PostEvent(BraveUtility.RandomElement(SoundFXList), gameObject);
                    if (BraveUtility.RandomBool())
                    {
                        AkSoundEngine.PostEvent("Play_PET_junk_splat_01", gameObject);
                    }
                }
            }
        }
Пример #22
0
    void AnimationEventHandler(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNum)
    {
        string str = animator.name + "\n" + clip.name + "\n" + "INFO: " + clip.GetFrame(frameNum).eventInfo;

        StartCoroutine(PopupText(str));
    }
 void AnimationEventHandler(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameNum)
 {
     string str = animator.name + "\n" + clip.name + "\n" + "INFO: " + clip.GetFrame(frameNum).eventInfo;
     Debug.Log(str);
     StartCoroutine( PopupText( str ) );
 }
Пример #24
0
        // Heres where a lot of the real function of the gun lies, in the animation events.
        // This is where the gun's sound plays, where the dash happens, and where the swing damage happens.
        private void AnimationEventTriggered(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip, int frameIdx)
        {
            // This event happens near the beginning of the shoot animation, and only happens once per combo.
            if (clip.GetFrame(frameIdx).eventInfo == "removeClicked")
            {
                // This part plays the audio for the initial swing, with a quarter second delay to make it match the animation.
                int num = UnityEngine.Random.Range(1, 4);
                StartCoroutine(PostEventDelayed($"Play_spccleaver_swing_00" + num, 0.25f));

                // Set clicked to false so that the initial shot click doesn't count towards your combo.
                clicked = false;
            }

            // This event happens every time the gun's intro gets played, which happens in a load of different scenarios.
            // All it does is clear the cooldown on the gun so that you can fire it again.
            if (clip.GetFrame(frameIdx).eventInfo == "refreshCooldown")
            {
                gun.ClearCooldowns();
            }

            // This event occurs every time a swing happens in the animation.
            // This handles a lot of the gun's function.
            if (clip.GetFrame(frameIdx).eventInfo == "clickCheck")
            {
                if (clicked == false || gun.CurrentOwner.CurrentGun != gun) // This happens if you have NOT clicked since last click check, or if you aren't actually holding the gun.
                {
                    // Checks if an enemy is currently being targeted, if it is then unstun it and make it able to be affected by knockback.
                    // This is done because when you dash and hit an enemy, it gets stunned and immune to knockback.
                    // This code makes it so that when you finish your combo early, it's no longer stunned and gets it's knockback resistance removed.
                    if (highlightedEnemy != null)
                    {
                        if (highlightedEnemy.behaviorSpeculator && highlightedEnemy.behaviorSpeculator.IsStunned)
                        {
                            highlightedEnemy.behaviorSpeculator.EndStun();
                        }
                        if (highlightedEnemy.knockbackDoer)
                        {
                            highlightedEnemy.knockbackDoer.SetImmobile(false, "combo");
                        }
                    }
                    DeselectEnemy();                             // Deselect the enemy, because if you finish your combo early the enemy shouldn't still be selected.

                    gun.spriteAnimator.Play(gun.introAnimation); // Play the gun's intro animation. This is done for 2 reasons:
                                                                 // 1. It makes the animations look nice. The way I designed the animations make it so that after every click check, the intro animation will look smooth.
                                                                 // 2. It calls the refreshCooldown event, which, when handled, allows you to shoot the cannonball projectile again to target another enemy.
                }
                else // This happens if you DID click since the last click check.
                {
                    bool slashedEnemy = false;                                            // This variable keeps track of whether or not you actually dealt damage to the enemy with this swing.
                                                                                          // This is used to determine which swing sound to play, the standard sound or the impact sound.

                    clicked = false;                                                      // Sets clicked back to false, so you have to click again before the next click check.

                    if (highlightedEnemy != null && !highlightedEnemy.healthHaver.IsDead) // The following code only happens if you have an enemy selected, meaning you hit it with your projectile.
                    {
                        if (assaultLevel == -1)                                           // This happens when your assault level is -1, meaning you haven't yet dashed at the enemy.
                        {
                            // Make the player immune to damage for 1 second to avoid unfair damage during dash
                            gun.CurrentOwner.healthHaver.TriggerInvulnerabilityPeriod(1f);

                            // Stun the enemy for 1 second.
                            if (highlightedEnemy.behaviorSpeculator)
                            {
                                highlightedEnemy.behaviorSpeculator.Stun(1f);
                            }

                            // Make the enemy immune to knockback so it doesnt get pushed away during the dash, while other enemies do
                            if (highlightedEnemy.knockbackDoer)
                            {
                                highlightedEnemy.knockbackDoer.SetImmobile(true, "combo");
                            }

                            // time to dash
                            StartCoroutine(LaunchPlayer(gun.CurrentOwner as PlayerController, highlightedEnemy));

                            assaultLevel = 1; // Sets the assault level to 1, indicating that you have dashed and that your combo is now a combo of 1.
                        }
                        else // This code happens if you HAVE already dashed at the enemy.
                        {
                            float damage = 1.5f * assaultLevel; // Damage calculation. The higher your assault level (combo), the higher the damage.

                            // If the player has the Combo King synergy, double the damage of the combo swing
                            if ((gun.CurrentOwner as PlayerController).PlayerHasActiveSynergy("Combo King"))
                            {
                                damage *= 2f;
                            }

                            // This code only occurs if you're close enough the the target enemy to actually hit it with a melee swing.
                            // This is so that you can't target an enemy, move away, then start meleeing other enemies to get a huge combo. you instead have to target and kill one enemy first
                            if ((highlightedEnemy.CenterPosition - gun.CurrentOwner.CenterPosition).magnitude < 3f)
                            {
                                // Make the enemy's skull above their head shake a little bit.
                                // (This skull is created upon the selection of an enemy)
                                var sc = highlightedEnemy.GetComponent <SkullController>();
                                if (sc)
                                {
                                    sc.shakeAmount = 0.25f;
                                }

                                // This happens if the targeted enemy's health is less than the damage you would deal to it.
                                if (highlightedEnemy.healthHaver.GetCurrentHealth() <= damage)
                                {
                                    if (sc)
                                    {
                                        sc.BigSkullAndCrossbones();     // Activate the big skull and crossbones 3D death effect.
                                    }
                                    bool hasCannonballSynergy = (gun.CurrentOwner as PlayerController).PlayerHasActiveSynergy("Cannons Away");

                                    // Fire 12 decent damage cannonballs, or 24 if the player has the cannons away synergy
                                    int cannonballAmount = (hasCannonballSynergy ? 24 : 12);
                                    for (int i = 0; i < cannonballAmount; i++)
                                    {
                                        GameObject gameObject = SpawnManager.SpawnProjectile(gun.DefaultModule.projectiles[0].gameObject, highlightedEnemy.CenterPosition, Quaternion.Euler(0f, 0f, i * (360f / (float)cannonballAmount)), true);
                                        Projectile component  = gameObject.GetComponent <Projectile>();
                                        component.Owner = gun.CurrentOwner;
                                        component.specRigidbody.RegisterSpecificCollisionException(highlightedEnemy.specRigidbody);
                                        component.baseData.damage *= hasCannonballSynergy ? 5f : 2f; // Deal more damage if the player has the synergy
                                        //component.transform.eulerAngles = new Vector3(0f, 0f, (i * 30f) - 90f);

                                        component.OverrideMotionModule = new SimpleCannonballProjectile(); // Assign the cannonballs a motion module, giving it afterimages and allowing it to speed up.
                                    }
                                    LaunchParticles(0f, 360, 1f, 1f, 3000, 15, 2f);                        // Fire off a death particle burst

                                    if ((gun.CurrentOwner as PlayerController).PlayerHasActiveSynergy("Axes Don't Reload"))
                                    {
                                        gun.spriteAnimator.Play(gun.introAnimation); // If the player has the Axes Don't Reload synergy, instead of forcing a gun reload, simply play the intro animation again to reset the projectile cooldown.
                                    }
                                    else
                                    {
                                        gun.Reload(); // Force the gun to reload, so you can't instantly shoot another projectile
                                    }
                                }

                                // Deal damage
                                ExploderExtensions.DoRadialDamageNoIFrames(damage, gun.CurrentOwner.CenterPosition, 3f, false, true);

                                // If the gun isn't reloading (aka if the enemy didn't just die), launch particles in the direction of the slash
                                if (!gun.IsReloading)
                                {
                                    LaunchParticles((highlightedEnemy.CenterPosition - gun.CurrentOwner.CenterPosition).ToAngle() - 40f + (50f * (frameIdx == 10 ? 1f : -1f) * ((gun.CurrentAngle > -90f || gun.CurrentAngle < 90f) ? 1f : -1f)));
                                }

                                slashedEnemy = true; // Indicate that the impact sound should be played rather than the standard swing sound
                                assaultLevel++;      // Increase the combo

                                // Stun the enemy for an additional half-second so it doesn't start shooting at you mid-combo
                                if (highlightedEnemy.behaviorSpeculator)
                                {
                                    highlightedEnemy.behaviorSpeculator.Stun(0.5f);
                                }
                            }
                        }
                    }

                    // Play the swing sound or the impact sound depending on the value of the slashedEnemy variable after a fifth of a second delay to sync with the animation
                    int num = UnityEngine.Random.Range(1, 4);
                    StartCoroutine(PostEventDelayed($"Play_spccleaver_{(slashedEnemy ? "impact" : "swing")}_00" + num, 0.2f));
                }
            }
        }
Пример #25
0
 void OnAnimEvent(tk2dSpriteAnimator aAnim, tk2dSpriteAnimationClip aClip, int frame) {
     if(anim == aAnim && aClip == mClips[(int)AnimState.attack]) {
         tk2dSpriteAnimationFrame frameDat = aClip.GetFrame(frame);
         if(frameDat.eventInfo == "actS") {
             mActActive = true;
         }
         else if(frameDat.eventInfo == "actE") {
             mActActive = false;
         }
     }
 }
Пример #26
0
 //called on the impact frame of a punch
 void PunchEvent(tk2dSpriteAnimator sprite, tk2dSpriteAnimationClip clip, int frameNum)
 {
     // create the punch hit box
     GameObject clone = Instantiate(punchBox, new Vector3(transform.position.x+2,transform.position.y,0), transform.rotation) as GameObject;
     clone.transform.parent = transform;
     // set strength based on which punch it is
     // by getting the frame info from the anim trigger
         if (clip.GetFrame(frameNum).eventInfo == "punch1")
         {
             clone.GetComponent<punchCollider>().strength = punch1Strength;
         }
         if (clip.GetFrame(frameNum).eventInfo == "punch2")
         {
             clone.GetComponent<punchCollider>().strength = punch2Strength;
             clone.transform.position = new Vector3(transform.position.x+3.5f,transform.position.y,0);
         }
         if (clip.GetFrame(frameNum).eventInfo == "airPunch1")
         {
             clone.GetComponent<punchCollider>().strength = punch3Strength;
             clone.transform.position = new Vector3(transform.position.x+1.5f,transform.position.y-1f,0);
         }
         if (clip.GetFrame(frameNum).eventInfo == "uppercut1")
         {
             clone.GetComponent<punchCollider>().strength = punch4Strength;
             clone.transform.position = new Vector3(transform.position.x+1.5f,transform.position.y+1f,0);
         }
         if (clip.GetFrame(frameNum).eventInfo == "uppercut2")
         {
             clone.GetComponent<punchCollider>().strength = uppercutStrength;
             clone.transform.position = new Vector3(transform.position.x+1.5f,transform.position.y+1f,0);
             //second uppercut gets a little vertical boost
             velocity = new Vector3(0.8f,1.25f,0);
         }
         //print(frame.eventInfo);
 }