public override void Initialize()
        {
            level = Levels.grassLevel;
            StateManager.AddState(Settings.STATES.ArmyEditor);

            shineForeground          = AnimationAssets.ShineEffect;
            shineForeground.Position = new Vector2(768 / 2, 768 / 2);
        }
Beispiel #2
0
        public override void Initialize()
        {
            Globals.multiplayerConnection = new MultiplayerConnection();

            Globals.multiplayerConnection.ReceiveArmy       += ReceivedArmy;
            Globals.multiplayerConnection.ReceiveConnection += ReceivedConnection;

            searchMatchAnimation          = AnimationAssets.MatchFinderAnimation;
            searchMatchAnimation.Position = Main.WindowCenter;
        }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        if (property.propertyType != SerializedPropertyType.String)
        {
            EditorGUI.LabelField(position, "ERROR:", "May only apply to type string");
            return;
        }

        SpineAnimation attrib = (SpineAnimation)attribute;

        var dataProperty = property.serializedObject.FindProperty(attrib.dataField);

        if (dataProperty != null)
        {
            if (dataProperty.objectReferenceValue is SkeletonDataAsset)
            {
                skeletonDataAsset = (SkeletonDataAsset)dataProperty.objectReferenceValue;
            }
            else if (dataProperty.objectReferenceValue is SkeletonRenderer)
            {
                var renderer = (SkeletonRenderer)dataProperty.objectReferenceValue;
                if (renderer != null)
                {
                    skeletonDataAsset = renderer.skeletonDataAsset;
                }
            }
            else
            {
                EditorGUI.LabelField(position, "ERROR:", "Invalid reference type");
                return;
            }
        }
        else if (property.serializedObject.targetObject is Component)
        {
            var component = (Component)property.serializedObject.targetObject;
            if (component.GetComponentInChildren <SkeletonRenderer>() != null)
            {
                var skeletonRenderer = component.GetComponentInChildren <SkeletonRenderer>();
                skeletonDataAsset = skeletonRenderer.skeletonDataAsset;
            }
        }

        if (skeletonDataAsset == null)
        {
            EditorGUI.LabelField(position, "ERROR:", "Must have reference to a SkeletonDataAsset");
            return;
        }

        position = EditorGUI.PrefixLabel(position, label);

        if (GUI.Button(position, property.stringValue, EditorStyles.popup))
        {
            Selector(property);
        }
    }
Beispiel #4
0
    void Init(GameObject inst)
    {
        anim = inst.GetComponent <SpineAnimation> ();

        Spine.SkeletonData data = anim.skeleton.skeleton.data;

        Spine.Animation up = data.FindAnimation("jump_up");

        Spine.Animation dn = data.FindAnimation("jump_down");

        jumpFlightTime = GetJumpLength(up);
        fallFlightTime = GetJumpLength(dn);

        //Subscribe to events
        anim.skeleton.state.Event    += HandleCustomEvent;
        anim.skeleton.state.Complete += OnJumpEnd;
    }
    void Selector(SerializedProperty property)
    {
        SpineAnimation attrib = (SpineAnimation)attribute;

        GenericMenu menu = new GenericMenu();

        var animations = skeletonDataAsset.GetAnimationStateData().SkeletonData.Animations;

        for (int i = 0; i < animations.Count; i++)
        {
            string name = animations[i].Name;
            if (name.StartsWith(attrib.startsWith))
            {
                menu.AddItem(new GUIContent(name), name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
            }
        }

        menu.ShowAsContext();
    }
Beispiel #6
0
        private void DealDamage(Character attacker, Character defender)
        {
            switch (attacker.special)
            {
            case Character.Special.None:
                damage = WeaponDamage(attacker.weapon, defender.weapon);
                if (damage == 1)
                {
                    currentAnimation = weaponAnimations[attacker.weapon];
                }
                else
                {
                    currentAnimation = criticalAnimations[attacker.weapon];
                }
                break;

            case Character.Special.Miner:
                if (defender.special == Character.Special.Bomb)
                {
                    damage = Math.Max(3, defender.hp);
                }
                else
                {
                    damage = 1;
                }

                currentAnimation = specialAnimations[attacker.special];
                break;

            case Character.Special.Spy:
                if (defender.rank == Character.Rank.Leader)
                {
                    damage = Math.Max(3, defender.hp);
                }
                else
                {
                    damage = 1;
                }

                currentAnimation = specialAnimations[attacker.special];
                break;

            case Character.Special.Bomb:
                damage           = Math.Max(3, defender.hp);
                currentAnimation = specialAnimations[attacker.special];
                break;

            case Character.Special.Healer:
                if (isHealing)
                {
                    damage           = Math.Max(-2, -(defender.maxHP - defender.hp));
                    currentAnimation = specialAnimations[attacker.special];
                }
                else
                {
                    damage           = 0;
                    currentAnimation = specialAnimations[attacker.special];
                }
                break;

            default:
                damage           = 1;
                currentAnimation = weaponAnimations[attacker.weapon];
                break;
            }
        }
Beispiel #7
0
        public override void Initialize()
        {
            #region SET DICTIONARIES
            // WEAPON DICTIONARY
            weaponAnimations = new Dictionary <Character.Weapon, SpineAnimation>();

            weaponAnimations.Add(Character.Weapon.Axe, AnimationAssets.AxeNormalAttack);
            weaponAnimations[Character.Weapon.Axe].loop  = false;
            weaponAnimations[Character.Weapon.Axe].Scale = WEAPON_SCALE;

            weaponAnimations.Add(Character.Weapon.Sword, AnimationAssets.SwordNormalAttack);
            weaponAnimations[Character.Weapon.Sword].loop  = false;
            weaponAnimations[Character.Weapon.Sword].Scale = WEAPON_SCALE;

            weaponAnimations.Add(Character.Weapon.Shield, AnimationAssets.ShieldNormalAttack);
            weaponAnimations[Character.Weapon.Shield].loop  = false;
            weaponAnimations[Character.Weapon.Shield].Scale = WEAPON_SCALE;

            weaponAnimations.Add(Character.Weapon.None, AnimationAssets.AxeNormalAttack);
            weaponAnimations[Character.Weapon.None].loop  = false;
            weaponAnimations[Character.Weapon.None].Scale = .13f;

            // CRITICAL DICTIONARY
            criticalAnimations = new Dictionary <Character.Weapon, SpineAnimation>();

            criticalAnimations.Add(Character.Weapon.Axe, AnimationAssets.AxeCritAttack);
            criticalAnimations[Character.Weapon.Axe].loop  = false;
            criticalAnimations[Character.Weapon.Axe].Scale = WEAPON_SCALE;

            criticalAnimations.Add(Character.Weapon.Sword, AnimationAssets.SwordCritAttack);
            criticalAnimations[Character.Weapon.Sword].loop  = false;
            criticalAnimations[Character.Weapon.Sword].Scale = WEAPON_SCALE;

            criticalAnimations.Add(Character.Weapon.Shield, AnimationAssets.ShieldCritAttack);
            criticalAnimations[Character.Weapon.Shield].loop  = false;
            criticalAnimations[Character.Weapon.Shield].Scale = WEAPON_SCALE;

            // SPECIAL DICTIONARY
            specialAnimations = new Dictionary <Character.Special, SpineAnimation>();

            specialAnimations.Add(Character.Special.Bomb, AnimationAssets.Explosion);
            specialAnimations[Character.Special.Bomb].Position = Main.WindowCenter;
            specialAnimations[Character.Special.Bomb].loop     = false;

            specialAnimations.Add(Character.Special.Healer, AnimationAssets.HealSpecial);
            specialAnimations[Character.Special.Healer].Position = Main.WindowCenter;
            specialAnimations[Character.Special.Healer].loop     = false;

            specialAnimations.Add(Character.Special.Miner, AnimationAssets.MinerSpecial);
            specialAnimations[Character.Special.Miner].Position = Main.WindowCenter;
            specialAnimations[Character.Special.Miner].loop     = false;

            specialAnimations.Add(Character.Special.Spy, AnimationAssets.SpySpecial);
            specialAnimations[Character.Special.Spy].Position = Main.WindowCenter;
            specialAnimations[Character.Special.Spy].loop     = false;

            // RANK NAME FRAMES
            rankNameFrames = new Dictionary <Character.Rank, int>();
            rankNameFrames.Add(Character.Rank.Leader, 4);
            rankNameFrames.Add(Character.Rank.General, 5);
            rankNameFrames.Add(Character.Rank.Captain, 6);
            rankNameFrames.Add(Character.Rank.Soldier, 7);
            rankNameFrames.Add(Character.Rank.Miner, 1);

            specialRankNameFrames = new Dictionary <Character.Special, int>();
            specialRankNameFrames.Add(Character.Special.Healer, 1);
            specialRankNameFrames.Add(Character.Special.Miner, 2);
            specialRankNameFrames.Add(Character.Special.Spy, 3);
            specialRankNameFrames.Add(Character.Special.Bomb, 8);

            // HIT MOMENTS
            hitMoments = new Dictionary <Character.Weapon, float>();
            hitMoments.Add(Character.Weapon.Axe, AXE_HIT_TIME);
            hitMoments.Add(Character.Weapon.Sword, SWORD_HIT_TIME);
            hitMoments.Add(Character.Weapon.Shield, SHIELD_HIT_TIME);
            hitMoments.Add(Character.Weapon.None, AXE_HIT_TIME);

            // REWARDS
            rewards = new Dictionary <Character.Rank, int>();
            rewards.Add(Character.Rank.Soldier, 10);
            rewards.Add(Character.Rank.Captain, 20);
            rewards.Add(Character.Rank.General, 30);
            rewards.Add(Character.Rank.Bomb, 30);
            rewards.Add(Character.Rank.Miner, 30);
            rewards.Add(Character.Rank.Spy, 30);
            rewards.Add(Character.Rank.Healer, 30);
            rewards.Add(Character.Rank.Leader, 100);
            #endregion

            // DAMAGE SPRITE
            damageSprite             = ArtAssets.DamageTextSprite;
            damageSpriteAlpha        = 0f;
            damageSprite.colorEffect = Color.White * damageSpriteAlpha;

            // SETTING VALUES
            show          = true;
            flickerTimer  = 0;
            flickerAmount = FLICKER_LIMIT;
            timer         = 0;

            // UI
            background = ArtAssets.FightPopUp; background.position = Main.WindowCenter;
            vsText     = ArtAssets.VSText; vsText.position = Main.WindowCenter;

            axeIcon    = ArtAssets.AxeIcon; axeIcon.CurrentFrame = 2;
            swordIcon  = ArtAssets.SwordIcon; swordIcon.CurrentFrame = 2;
            shieldIcon = ArtAssets.ShieldIcon; shieldIcon.CurrentFrame = 2;

            myRankName          = ArtAssets.RankNamesBold;
            myRankName.position = MyRankNamePosition;

            enemyRankName          = ArtAssets.RankNamesBold;
            enemyRankName.position = EnemyRankNamePosition;

            // HIT EFFECT
            hitEffect          = AnimationAssets.HitEffect;
            hitEffect.loop     = false;
            hitEffect.Position = -Vector2.One * 100;
        }
        public static void LoadAnimations(GraphicsDevice graphicsDevice, ContentManager contentManager)
        {
            #region MEDIEVAL ARMY
            // MEDIEVAL Leader
            medievalLeader = new SpineAnimation();
            medievalLeader.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_LEADER);

            // MEDIEVAL GENERAL
            medievalGeneral = new SpineAnimation();
            medievalGeneral.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_GENERAL, "Idle");

            // MEDIEVAL Captain
            medievalCaptain = new SpineAnimation();
            medievalCaptain.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_CAPTAIN);

            // MEDIEVAL Soldier
            medievalSoldier = new SpineAnimation();
            medievalSoldier.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_SOLDIER);

            // MEDIEVAL MINOR
            medievalMiner = new SpineAnimation();
            medievalMiner.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_MINER);

            // MEDIEVAL HEALER
            medievalHealer = new SpineAnimation();
            medievalHealer.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_HEALER);
            medievalHealer.Offset = new Vector2(0, 2);

            // MEDIEVAL SPY
            medievalSpy = new SpineAnimation();
            medievalSpy.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_SPY);

            // MEDIEVAL BOMB
            medievalBomb = new SpineAnimation();
            medievalBomb.LoadAnimation(graphicsDevice, contentManager, MEDIEVAL_ARMY_PATH, MEDIEVAL_BOMB);
            #endregion
            #region TIKI ARMY
            // TIKI Leader
            tikiLeader = new SpineAnimation();
            tikiLeader.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_LEADER, "Idle");

            // TIKI GENERAL
            tikiGeneral = new SpineAnimation();
            tikiGeneral.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_GENERAL);
            tikiGeneral.Offset = new Vector2(0, 4);

            // TIKI Captain
            tikiCaptain = new SpineAnimation();
            tikiCaptain.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_CAPTAIN, "Idle");
            tikiCaptain.Offset = new Vector2(0, 10);

            // TIKI Soldier
            tikiSoldier = new SpineAnimation();
            tikiSoldier.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_SOLDIER);
            tikiSoldier.Offset = new Vector2(0, 8);

            // TIKI MINOR
            tikiMiner = new SpineAnimation();
            tikiMiner.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_MINER);

            // TIKI HEALER
            tikiHealer = new SpineAnimation();
            tikiHealer.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_HEALER);

            // TIKI SPY
            tikiSpy = new SpineAnimation();
            tikiSpy.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_SPY);

            // TIKI BOMB
            tikiBomb = new SpineAnimation();
            tikiBomb.LoadAnimation(graphicsDevice, contentManager, TIKI_ARMY_PATH, TIKI_BOMB);
            #endregion
            #region SEA ARMY
            // SEA Leader
            seaLeader = new SpineAnimation();
            seaLeader.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_LEADER);

            // SEA GENERAL
            seaGeneral = new SpineAnimation();
            seaGeneral.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_GENERAL);

            // SEA Captain
            seaCaptain = new SpineAnimation();
            seaCaptain.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_CAPTAIN);

            // SEA Soldier
            seaSoldier = new SpineAnimation();
            seaSoldier.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_SOLDIER);

            // SEA MINOR
            seaMiner = new SpineAnimation();
            seaMiner.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_MINER);

            // SEA HEALER
            seaHealer = new SpineAnimation();
            seaHealer.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_HEALER);

            // SEA SPY
            seaSpy = new SpineAnimation();
            seaSpy.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_SPY);

            // SEA BOMB
            seaBomb = new SpineAnimation();
            seaBomb.LoadAnimation(graphicsDevice, contentManager, SEA_ARMY_PATH, SEA_BOMB);
            #endregion

            // SHINE EFFECT
            shineEffect = new SpineAnimation();
            shineEffect.LoadAnimation(graphicsDevice, contentManager, BACKGROUND_PATH, SHINE_EFFECT);

            // WEAPON AXE
            axeNormalAttack = new SpineAnimation();
            axeNormalAttack.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, WEAPON_AXE, AXE_NORMAL_ANIMATION);
            axeCritAttack = new SpineAnimation();
            axeCritAttack.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, WEAPON_AXE, AXE_CRIT_ANIMATION);

            // WEAPON SWORD
            swordNormalAttack = new SpineAnimation();
            swordNormalAttack.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, WEAPON_SWORD, SWORD_NORMAL_ANIMATION);
            swordCritAttack = new SpineAnimation();
            swordCritAttack.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, WEAPON_SWORD, SWORD_CRIT_ANIMATION);

            // WEAPON SHIELD
            shieldNormalAttack = new SpineAnimation();
            shieldNormalAttack.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, WEAPON_SHIELD, SHIELD_NORMAL_ANIMATION);
            shieldCritAttack = new SpineAnimation();
            shieldCritAttack.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, WEAPON_SHIELD, SHIELD_CRIT_ANIMATION);

            // SPY SPECIAL
            spySpecial = new SpineAnimation();
            spySpecial.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, SPY_SPECIAL, "BackstabBack");
            spySpecialHitEffect = new SpineAnimation();
            spySpecialHitEffect.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, SPY_SPECIAL, "BackstabFront");

            // HEAL SPECIAL
            healSpecial = new SpineAnimation();
            healSpecial.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, HEAL_SPECIAL);

            // MINER SPECIAL
            minerSpecial = new SpineAnimation();
            minerSpecial.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, MINER_SPECIAL);

            // BOMB EXPLOSION
            explosion = new SpineAnimation();
            explosion.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, BOMB_SPECIAL);

            // HIT
            hitEffect = new SpineAnimation();
            hitEffect.LoadAnimation(graphicsDevice, contentManager, WEAPON_ANIMATION_PATH, HIT_EFFECT, "animation2");

            // UI
            arrowIcon = new SpineAnimation();
            arrowIcon.LoadAnimation(graphicsDevice, contentManager, UI_ANIMATION_PATH, MOVEMENT_ATTACK_ICON, MOVEMENT_ICON_ANIMATION);

            attackIcon = new SpineAnimation();
            attackIcon.LoadAnimation(graphicsDevice, contentManager, UI_ANIMATION_PATH, MOVEMENT_ATTACK_ICON, ATTACK_ICON_ANIMATION);

            healIcon = new SpineAnimation();
            healIcon.LoadAnimation(graphicsDevice, contentManager, UI_ANIMATION_PATH, HEAL_ICON, "Heal");

            // MATCHFINDER
            matchFinderAnimation = new SpineAnimation();
            matchFinderAnimation.LoadAnimation(graphicsDevice, contentManager, UI_ANIMATION_PATH, MATCHFINDER);
        }