Exemplo n.º 1
0
    public override void Update(float deltaTime)
    {
        if (character.stateCurrent != name)
        {
            character.opacity = 1;

            CharacterEffect effectInvuln = character.GetEffect("invulnerable");
            if (effectInvuln == null)
            {
                return;
            }
            float invulnTimer = effectInvuln.duration;

            int frame = (int)Mathf.Round(invulnTimer * 60);
            character.opacity = (frame % 8) > 3 ? 1 : 0;
            return;
        }

        character.velocity += new Vector3(
            0,
            character.stats.Get("hurtGravity"),
            0
            ) * deltaTime * 60F;

        character.AnimatorPlay("Hurt");
        character.spriteContainer.eulerAngles = Vector3.zero;
        character.flipX = !character.facingRight;

        failsafeTimer -= deltaTime;
        if (failsafeTimer <= 0)
        {
            character.stateCurrent = "air";
        }
    }
Exemplo n.º 2
0
    public override void StateInit(string stateName, string prevStateName)
    {
        if (character.stateCurrent != "homingAttack")
        {
            return;
        }

        failsafeTimer = 5F;
        SFX.PlayOneShot(character.audioSource, "sfxHomingAttack");

        target = FindClosestTarget();

        if (target == null)
        {
            var XvalueOfVeloc = character.stats.Get("homingAttackSpeed") * (character.facingRight ? 1 : -1);
            character.velocity     = new Vector2(XvalueOfVeloc, 0);
            character.stateCurrent = "rollingAir";
            character.effects.Add(new CharacterEffect(character, "afterImage", 0.25F));
        }
        else
        {
            character.velocity         = Vector3.zero;
            character.modeGroupCurrent = character.rollingAirModeGroup;
            afterImageEffect           = new CharacterEffect(character, "afterImage");
            character.effects.Add(afterImageEffect);
        }
    }
Exemplo n.º 3
0
 public void ClearEffects()
 {
     // iterate backwards to prevent index from shifting
     for (int i = effects.Count - 1; i >= 0; i--)
     {
         CharacterEffect effect = effects[i];
         effect.DestroyBase();
     }
 }
Exemplo n.º 4
0
    //Add a buff to the buff bar
    public void AddBuffToBar(CharacterEffect effect)
    {
        GameObject temp = Instantiate(defaultEffectThumbNail, Vector3.zero, Quaternion.identity) as GameObject;

        temp.transform.SetParent(buffPanel.transform);
        CharacterEffectThumbnail temp2 = temp.GetComponent <CharacterEffectThumbnail>();

        temp2.effect = effect;
    }
Exemplo n.º 5
0
    void OnTriggerStay(Collider other)
    {
        if (collected)
        {
            return;
        }
        Character[] characters = other.gameObject.GetComponentsInParent <Character>();
        if (characters.Length == 0)
        {
            if (!falling)
            {
                return;
            }
            if (other.isTrigger)
            {
                return;
            }

            Vector3 velocity = rigidbody.velocity;
            velocity.y         = Mathf.Max(1F * Utils.physicsScale, Mathf.Abs(velocity.y) * 0.75F);
            rigidbody.velocity = velocity;
        }
        else
        {
            Character character = characters[0];
            if (character.InStateGroup("ignore"))
            {
                return;
            }

            CharacterEffect effectInvuln = character.GetEffect("invulnerable");
            if (effectInvuln != null)
            {
                float invulnTimer = effectInvuln.duration;
                if (invulnTimer > 1.5F)
                {
                    return;
                }
            }

            character.rings++;
            panStereo = -panStereo;

            GameObject ringSparkle = Instantiate(
                Constants.Get <GameObject>("prefabRingSparkle"),
                transform.position,
                Quaternion.identity
                );
            // Temp
            ringSparkle.GetComponent <AudioSource>().panStereo = panStereo;
            ringSparkle.GetComponent <AudioSource>().Play();

            collected = true;

            Destroy(gameObject);
        }
    }
        protected virtual void Awake()
        {
            animator = GetComponent <Animator>();
            navAgent = GetComponent <NavMeshAgent>();

            state    = gameObject.AddComponent <CharacterAnimation>();
            movement = gameObject.AddComponent <CharacterMovement>();
            fx       = gameObject.AddComponent <CharacterEffect>();
            navPath  = new NavMeshPath();
        }
Exemplo n.º 7
0
 public void UpdateEffects(float deltaTime)
 {
     // iterate backwards to prevent index from shifting
     // (effects remove themselves once complete)
     for (int i = effects.Count - 1; i >= 0; i--)
     {
         CharacterEffect effect = effects[i];
         effect.UpdateBase(deltaTime);
     }
 }
    public void SpawnEffect(string _effectName)
    {
        CharacterEffect _effect = effects.Find(x => (x.effectName == _effectName));

        if (_effect != null)
        {
            GameObject particle = Instantiate(_effect.particle) as GameObject;
            //particle.transform.parent = transform;
            particle.transform.position = new Vector3(_effect.effectPosition.x * Mathf.Sign(transform.lossyScale.x), _effect.effectPosition.y, 0f) + transform.position;
            Destroy(particle, _effect.lifeTime);
        }
    }
Exemplo n.º 9
0
 public override void OnInit()
 {
     this.m_CoroutineManager.StopAllCoroutine();
     if (this.self != null)
     {
         this.mCharacterEffect = this.self.mCharacterEffect;
     }
     if (this.self.isHero || this.self.isMonster || this.self.isHome || this.self.isTower || this.self.isItem)
     {
         if (this.mCharacterEffect != null)
         {
             if (this.self.isHome)
             {
                 Renderer[] componentsInChildren = this.self.transform.GetComponentsInChildren <Renderer>();
                 this.mCharacterEffect.SetRenderer(componentsInChildren);
                 this.mCharacterEffect.SetOutlineWidth(0.035f);
             }
             this.mCharacterEffect.InitRenderer(this.self, this.mRenders);
             this.mCharacterEffect.isActive = true;
         }
         if (this.self.isPlayer && this.mCharacterEffect != null)
         {
             this.mCharacterEffect.SetColor_Outline(Color.black);
             this.mCharacterEffect.SetIsHero(true);
         }
         else if (this.self.isHero)
         {
             if (this.self.isMyTeam && this.mCharacterEffect != null)
             {
                 this.mCharacterEffect.SetColor_Outline(Color.black);
             }
             else if (this.self.isEnemy && this.mCharacterEffect != null)
             {
                 this.mCharacterEffect.SetColor_Outline(Color.black);
             }
             if (this.mCharacterEffect != null)
             {
                 this.mCharacterEffect.SetIsHero(true);
             }
         }
         else if (this.self.isMonster && this.mCharacterEffect != null)
         {
             this.mCharacterEffect.SetIsHero(false);
         }
         else if (this.self.isTower && this.mCharacterEffect != null)
         {
             this.mCharacterEffect.SetOutlineWidth(0.035f);
         }
         this.RevertModel();
     }
     this._hasHud = this.IsHaveHudBarAndHudText();
 }
        public void TriggerActivationEffect()
        {
            CharacterEffect activationEffect = m_characterData.activationEffect;

            if (!(null == activationEffect))
            {
                Component val = activationEffect.Instantiate(m_cellObject.get_transform(), this);
                if (null != val)
                {
                    this.StartCoroutine(activationEffect.DestroyWhenFinished(val));
                }
            }
        }
Exemplo n.º 11
0
        public void TriggerActionEffect(Vector2Int target)
        {
            CharacterEffect actionEffect = m_characterData.actionEffect;

            if (!(null == actionEffect))
            {
                CellObject cellObject = m_cellObject.parentMap.GetCellObject(target.get_x(), target.get_y());
                Component  val        = actionEffect.Instantiate(cellObject.get_transform(), this);
                if (null != val)
                {
                    this.StartCoroutine(actionEffect.DestroyWhenFinished(val));
                }
            }
        }
Exemplo n.º 12
0
    //Add an effect to our effects list
    public void AddEffect(GameObject effect, Unit caster = null)
    {
        //Instantiate the effect and get the actual effect off the gameobject
        GameObject newEffectObject = Instantiate(effect, transform.position, Quaternion.identity) as GameObject;

        newEffectObject.transform.parent = transform;

        CharacterEffect newEffect = newEffectObject.GetComponent <CharacterEffect>();

        //Add the effect to the character, initialize it
        effects.Add(newEffect);
        newEffect.unitAffected = this;
        newEffect.caster       = caster;
        newEffect.OnApply();
    }
Exemplo n.º 13
0
    public override void StateInit(string stateName, string prevStateName)
    {
        if (character.stateCurrent != "lightDash")
        {
            return;
        }

        failsafeTimer = 5F;
        SFX.Play(character.audioSource, "sfxLightDash");
        character.velocity         = Vector3.zero;
        character.modeGroupCurrent = character.airModeGroup;
        afterImageEffect           = new CharacterEffect(character, "afterImage");
        character.effects.Add(afterImageEffect);
        character.AnimatorPlay("Light Dash");
    }
Exemplo n.º 14
0
        public IEnumerator PlayDeathEffect()
        {
            CharacterEffect deathEffect = GetAnimatedCharacterData().deathEffect;

            if (!(null == deathEffect))
            {
                Component val = deathEffect.Instantiate(m_cellObject.get_transform(), this);
                if (null != val)
                {
                    this.StartCoroutine(deathEffect.DestroyWhenFinished(val));
                }
                m_deathEffectInstance = val;
                do
                {
                    yield return(null);
                }while (null != m_deathEffectInstance && m_deathEffectInstance.get_gameObject().get_activeSelf());
            }
        }
Exemplo n.º 15
0
 private void Awake()
 {
     effecter = FindObjectOfType <CharacterEffect>();
 }
 private void Start()
 {
     animator    = GetComponent <Animator>();
     gameManager = FindObjectOfType <GameManager>();
     effecter    = FindObjectOfType <CharacterEffect>();
 }
Exemplo n.º 17
0
        public void Load(string filePath)
        {
            var fh = new FileHandler(filePath, FileHandler.FileOpenMode.Reading, Encoding.UTF8);

            short skeletonFileCount = fh.Read <short>();

            for (int i = 0; i < skeletonFileCount; i++)
            {
                string skeletonFile = fh.Read <ZString>();
                SkeletonFiles.Add(skeletonFile);
            }

            short motionFileCount = fh.Read <short>();

            for (int i = 0; i < motionFileCount; i++)
            {
                string motionFile = fh.Read <ZString>();

                MotionFiles.Add(motionFile);
            }

            short effectFileCount = fh.Read <short>();

            for (int i = 0; i < effectFileCount; i++)
            {
                string effectFile = fh.Read <ZString>();

                EffectFiles.Add(effectFile);
            }

            short characterCount = fh.Read <short>();

            for (int i = 0; i < characterCount; i++)
            {
                Character character = new Character();
                character.IsEnabled = fh.Read <char>() != 0;

                if (character.IsEnabled)
                {
                    character.ID   = fh.Read <short>();
                    character.Name = fh.Read <ZString>();

                    short objectCount = fh.Read <short>();

                    for (int j = 0; j < objectCount; j++)
                    {
                        CharacterObject @object = new CharacterObject();
                        @object.Object = fh.Read <short>();

                        character.Objects.Add(@object);
                    }

                    short animationCount = fh.Read <short>();

                    for (int j = 0; j < animationCount; j++)
                    {
                        CharacterAnimation animation = new CharacterAnimation();
                        animation.Type      = (AnimationType)fh.Read <short>();
                        animation.Animation = fh.Read <short>();

                        character.Animations.Add(animation);
                    }

                    short effectCount = fh.Read <short>();

                    for (int j = 0; j < effectCount; j++)
                    {
                        CharacterEffect effect = new CharacterEffect();
                        effect.Bone   = fh.Read <short>();
                        effect.Effect = fh.Read <short>();

                        character.Effects.Add(effect);
                    }
                }

                Characters.Add(character);
            }
        }
Exemplo n.º 18
0
        protected virtual void Awake()
        {
            animator = GetComponent<Animator>();
            navAgent = GetComponent<NavMeshAgent>();

            state = gameObject.AddComponent<CharacterAnimation>();
            movement = gameObject.AddComponent<CharacterMovement>();
            fx = gameObject.AddComponent<CharacterEffect>();
            navPath = new NavMeshPath();
        }
Exemplo n.º 19
0
 private void Awake()
 {
     audioPlayer = FindObjectOfType <CharacterAudio>();
     effecter    = FindObjectOfType <CharacterEffect>();
 }
Exemplo n.º 20
0
        private bool CharacterEffect_Apply(On.Sunshine.Metric.CharacterEffect.orig_Apply orig, CharacterEffect self, CharacterSheet ch, ModifierType type, IModifierCause modifierCause)
        {
            var modifier = self.GetModifier(type, modifierCause);

            if (self.effect == EffectType.STAT_BONUS)
            {
                for (int i = 0; i < ch.skills.Length; i++)
                {
                    if (ch.skills[i].abilityType == self.abilityType)
                    {
                        ch.skills[i].Add(modifier);
                    }
                }
            }

            return(orig(self, ch, type, modifierCause));
        }
Exemplo n.º 21
0
        private void CharacterEffect_Remove(On.Sunshine.Metric.CharacterEffect.orig_Remove orig, CharacterEffect self, CharacterSheet ch, ModifierType type, IModifierCause modifierCause)
        {
            var modifier = self.GetModifier(type, modifierCause);

            if (self.effect == EffectType.STAT_BONUS)
            {
                for (int i = 0; i < ch.skills.Length; i++)
                {
                    if (ch.skills[i].abilityType == self.abilityType)
                    {
                        ch.skills[i].Remove(modifier);
                    }
                }
            }

            orig(self, ch, type, modifierCause);
        }
Exemplo n.º 22
0
        public void Load(string filePath)
        {
            var fh = new FileHandler(filePath, FileHandler.FileOpenMode.Reading, Encoding.UTF8);

            short skeletonFileCount = fh.Read<short>();

            for (int i = 0; i < skeletonFileCount; i++)
            {
                string skeletonFile = fh.Read<ZString>();
                SkeletonFiles.Add(skeletonFile);
            }

            short motionFileCount = fh.Read<short>();

            for (int i = 0; i < motionFileCount; i++)
            {
                string motionFile = fh.Read<ZString>();

                MotionFiles.Add(motionFile);
            }

            short effectFileCount = fh.Read<short>();

            for (int i = 0; i < effectFileCount; i++)
            {
                string effectFile = fh.Read<ZString>();

                EffectFiles.Add(effectFile);
            }

            short characterCount = fh.Read<short>();

            for (int i = 0; i < characterCount; i++)
            {
                Character character = new Character();
                character.IsEnabled = fh.Read<char>() != 0;

                if (character.IsEnabled)
                {
                    character.ID = fh.Read<short>();
                    character.Name = fh.Read<ZString>();

                    short objectCount = fh.Read<short>();

                    for (int j = 0; j < objectCount; j++)
                    {
                        CharacterObject @object = new CharacterObject();
                        @object.Object = fh.Read<short>();

                        character.Objects.Add(@object);
                    }

                    short animationCount = fh.Read<short>();

                    for (int j = 0; j < animationCount; j++)
                    {
                        CharacterAnimation animation = new CharacterAnimation();
                        animation.Type = (AnimationType)fh.Read<short>();
                        animation.Animation = fh.Read<short>();

                        character.Animations.Add(animation);
                    }

                    short effectCount = fh.Read<short>();

                    for (int j = 0; j < effectCount; j++)
                    {
                        CharacterEffect effect = new CharacterEffect();
                        effect.Bone = fh.Read<short>();
                        effect.Effect = fh.Read<short>();

                        character.Effects.Add(effect);
                    }
                }

                Characters.Add(character);
            }
        }
Exemplo n.º 23
0
 //캐릭터 이펙트 활성/비활성
 void Activate_ChrcEffect(CharacterEffect effect, bool isActive)
 {
     Lst_CharacterEffects[(int)effect].SetActive(isActive);
 }