Exemple #1
0
            /// <summary>
            /// Moves a specified projectile hitbox a specified number of tiles at a specified speed.
            /// </summary>
            /// <param name="projectileChoreography">The <see cref="SkillChoreography"/> to be ran during the projectile's travel time.</param>
            /// <param name="onConnect">The <see cref="SkillChoreography"/> to be ran when the projectile connects with a target.</param>
            /// <param name="range">The amount of tiles the projectile should travel.</param>
            /// <param name="movementFrames">The amount of frames taken for the projectile to advance one tile.</param>
            protected void LaunchProjectile(SkillChoreography projectileChoreography, SkillChoreography onConnect, int range,
                                            float movementFrames)
            {
                //may need more params/extra info from json

                //TODO: projectile fire/movement
                RunSkillChoreography(onConnect);
            }
Exemple #2
0
            /// <summary>
            /// Sets the unit's animation to the one specified by the skill choreography, and places the hitboxes
            /// specified.
            /// </summary>
            /// <param name="skillChoreography">The skill choreography to run.</param>
            private void RunSkillChoreography(SkillChoreography skillChoreography)
            {
                Debug.Log("skillcho");
                int framesGiven = skillChoreography.GetTotalFrames();

                if (skillChoreography.GetIsAttackSpeedDependent())
                {
                    Debug.Log(framesGiven);
                    Debug.Log(unit.attackSpeed);
                    framesGiven = (int)Math.Round(framesGiven / unit.attackSpeed);
                }

                unit.SetAnimation(skillChoreography.GetAnimationPatternIndex(), framesGiven, false);

                UnitDetector unitDetector = UtilityFunctions.GetActiveUnitDetector();

                foreach (List <Hitbox> hitboxGroup in skillChoreography.GetHitboxGroups())
                {
                    string hitboxGroupID = "id:" +
                                           unit.GetHashCode() +
                                           "_" + GetHashCode() +
                                           "_" + skillChoreographies.GetHashCode() +
                                           "_" + hitboxGroup.GetHashCode() +
                                           "_" + UtilityFunctions.UnixTimeNow();

                    foreach (Hitbox hitbox in hitboxGroup)
                    {
                        hitbox.SetHitboxGroupID(hitboxGroupID);
                        hitbox.SetUnit(unit);
                        hitbox.SetSkill(this);
                        hitbox.AdjustPositionToUnit();

                        if (skillChoreography.GetIsAttackSpeedDependent())
                        {
                            hitbox.AdjustToAttackSpeed(unit.attackSpeed);
                        }

                        unitDetector.PlaceHitbox(hitbox);
                    }
                }
            }