void Start()
    {
        GameManager.instance = this;
        SPACE_HEIGHT_MOD     = new Vector3(0f, SpaceHeight, 0f);
        PopupTextController.Initialize();

        // Build the predefined scenarios
        undeadScene = new SceneActor[] {
            new SceneActor(true, 0, 25, 17, new Color(0, 0.47f, 1f, 0.58f)), // Paladin
            new SceneActor(false, 0, 28, 27, new Color(1f, 0, 0, 0.58f)),    // Skeleton
            new SceneActor(false, 0, 13, 30, new Color(1f, 0.5f, 0, 0.58f)),
            new SceneActor(false, 0, 20, 27, new Color(1f, 0.75f, 0, 0.58f)),
            new SceneActor(false, 1, 17, 29, new Color(0.5f, 0.75f, 0.5f, 0.58f)) // Zombie
        };
        koboldScene = new SceneActor[] {
            new SceneActor(true, 1, 28, 27, new Color(0, 0.8f, 0.5f, 0.58f)),   // Heavy Weapon Fighter
            new SceneActor(true, 2, 26, 29, new Color(0, 0.47f, 0.5f, 0.58f)),  // Bow Ranger
            new SceneActor(true, 3, 27, 26, new Color(0, 0.0f, 0.5f, 0.58f)),   // Rogue
            new SceneActor(false, 2, 13, 30, new Color(1f, 0.7f, 0.8f, 0.58f)), // Basic kobold
            new SceneActor(false, 2, 15, 24, new Color(1f, 0.3f, 0.8f, 0.58f)),
            new SceneActor(false, 2, 17, 20, new Color(1f, 0.5f, 0.0f, 0.58f)),
            new SceneActor(false, 2, 18, 22, new Color(1f, 0.1f, 0.4f, 0.58f)),
            new SceneActor(false, 3, 12, 28, new Color(1f, 0.75f, 0.2f, 0.58f)), // Kobold rogue
            new SceneActor(false, 4, 18, 25, new Color(1f, 0, 0, 0.58f)),        // Kobold sorcerer
        };

        // Generate game board made of one-by-one squares
        spaces = new Space[RowsX, ColsZ];
        GenerateSquares();
    }
Exemple #2
0
 void Awake()
 {
     PopupTextController.Initialize();
     attribute = new Attribute();
     setEnemyStatus();
     health.MaxValue     = attribute.getLife();
     health.CurrentValue = health.MaxValue;
     attackRate          = attribute.getDelay();
 }
Exemple #3
0
 override protected void Start()
 {
     manager = Object.FindObjectOfType <TurnManager>();
     panel   = Object.FindObjectOfType <GUIPanel>();
     PopupTextController.Initialize();
     creatureMechanics = GetComponent <CreatureMechanics>();
     selectedAction    = GetComponent <ActionBasicAttack>();
     //gameSignal = (GameSignalOneObject)Resources.Load("Game Signals/SetConcentration", typeof(GameSignalOneObject));
     base.Start();
 }
Exemple #4
0
 void Awake()
 {
     PopupTextController.Initialize();
     attribute = new Attribute();
     attribute.setStr(PlayerPrefs.GetFloat("str"));
     attribute.setDef(PlayerPrefs.GetFloat("def"));
     attribute.setAgi(PlayerPrefs.GetFloat("agi"));
     attribute.setDex(PlayerPrefs.GetFloat("dex"));
     attribute.setLuck(PlayerPrefs.GetFloat("luck"));
     attribute.setEnergy(PlayerPrefs.GetFloat("energy"));
     health.MaxValue     = attribute.getLife();
     health.CurrentValue = health.MaxValue;
     energy.MaxValue     = attribute.getTotalEnergy();
     energy.CurrentValue = energy.MaxValue;
     attackRate          = attribute.getDelay();
 }
 /// <summary>
 /// Shows the XP floaty text.
 /// </summary>
 /// <param name="awardedExperience">Awarded experience.</param>
 /// <param name="attacker">Attacker.</param>
 private void ShowXPFloatyText(int awardedExperience, Unit attacker)
 {
     PopupTextController.Initialize(attacker.GetCanvas());
     PopupTextController.CreatePopupText(string.Format("+ {0} XP", awardedExperience), attacker.transform.position, Color.yellow);
 }
    /// <summary>
    /// Performs the action of the attacker against their targets.
    /// </summary>
    /// <returns>The action.</returns>
    /// <param name="attacker">Attacker.</param>
    protected IEnumerator PerformAbilityAction(Unit attacker)
    {
        if (attacker.Action.Item != null)
        {
            // Lower music so you can hear ability SFX
            yield return(StartCoroutine(controller.MusicController.LowerCombatMusic()));

            // Show name of ability being used
            attacker.TileHighlighter.RemoveHighlightedTiles();
            Item item = attacker.Action.Item;
            controller.ActionController.Activate(item.Name);
            yield return(new WaitForSeconds(0.5f));

            // Spawn VFX on all targets
            List <Unit>       targets        = attacker.Action.Targets;
            List <GameObject> vfxGameObjects = ApplyVFXToTargets(item.VFXPath, targets);

            // Iterate over all effects, apply them, and if there is something to display, show it
            PopupTextController.Initialize(attacker.GetCanvas());
            List <Effect> effects = ConsumableEffectCalculator.GetConsumableEffects(item);
            yield return(StartCoroutine(ApplyEffects(targets, effects)));

            attacker.UpdateHealthbar();

            // Show XP floaty text
            ShowXPFloatyText(new ExperienceManager().AwardConsumableExperience(attacker), attacker);
            yield return(new WaitForSeconds(1.0f));

            // Destroy VFX's
            DestroyVFX(vfxGameObjects);

            // Remove name of used ability
            controller.ActionController.Deactivate();

            // Bring music back up to normal volume
            yield return(StartCoroutine(controller.MusicController.RaiseCombatMusic()));

            controller.ChangeState <TurnOverState> ();
        }
        // If the ability takes more than x turns, defer the ability action
        else if (!attacker.HasDeferredAbility && attacker.Action.Ability.Turns > 1)
        {
            attacker.HasDeferredAbility = true;
            yield return(null);

            controller.ChangeState <TurnOverState> ();
        }
        else
        {
            // Reset bool flags depending on if a deferred attack is being executed
            if (attacker.HasDeferredAbility)
            {
                attacker.HasDeferredAbility         = false;
                attacker.HasExecutedDeferredAbility = true;
            }

            // Lower music so you can hear ability SFX
            yield return(StartCoroutine(controller.MusicController.LowerCombatMusic()));

            // Show name of ability being used
            attacker.TileHighlighter.RemoveHighlightedTiles();
            Ability ability = attacker.Action.Ability;
            controller.ActionController.Activate(ability.Name);
            yield return(new WaitForSeconds(0.5f));

            // Spawn VFX on all targets
            List <Unit>       targets        = attacker.Action.Targets;
            List <GameObject> vfxGameObjects = ApplyVFXToTargets(ability.VFXPath, targets);

            // Start Combat
            Combat combat = new Combat(controller.HighlightedUnit);
            combat.Begin();

            // Play weapon sound effect
            Ability.AbilityType abilityType = attacker.Action.Ability.Type;
            if (abilityType == Ability.AbilityType.ATTACK || abilityType == Ability.AbilityType.TALENT)
            {
                attacker.PlayWeaponSound();
            }

            // Show target(s) being damaged
            ShowDamagedColorOnTargets(true, targets);

            // Play animations
            yield return(StartCoroutine(PlayAttackAnimations(attacker, targets [0].Tile)));

            // Iterate over all effects, apply them, and if there is something to display, show it
            PopupTextController.Initialize(attacker.GetCanvas());
            yield return(StartCoroutine(ApplyEffectsByUnit(attacker.Action.GetEffectsByUnit())));

            yield return(new WaitForSeconds(1.0f));

            // Stop showing target(s) being damaged
            ShowDamagedColorOnTargets(false, targets);

            // Show XP floaty text
            ShowXPFloatyText(combat.GetAwardedExperience(), attacker);
            yield return(new WaitForSeconds(1.0f));

            // Destroy VFX's
            DestroyVFX(vfxGameObjects);

            // Remove name of used ability
            controller.ActionController.Deactivate();

            // Bring music back up to normal volume
            yield return(StartCoroutine(controller.MusicController.RaiseCombatMusic()));

            controller.ChangeState <TurnOverState> ();
        }
    }
Exemple #7
0
 // Use this for initialization
 void Start()
 {
     PopupTextController.Initialize();
     Debug.Log(gameObject.name + " spawned with " + health + " hp.");
 }