Esempio n. 1
0
    public void Init(PlayerController owning_player, AbilityProperties properties, Vector3 origin, Vector3 facing)
    {
        this.owning_player = owning_player;
        this.properties    = properties;
        this.origin        = origin;
        this.facing        = facing;

        Destroy(gameObject, properties.lifetime);
    }
 /// <summary>
 /// Checks the ability vital, making sure there's enough to activate the ability.
 /// </summary>
 /// <returns><c>true</c>, if ability vital has enough to activate, <c>false</c> otherwise.</returns>
 /// <param name="ability">Ability.</param>
 private bool CheckAbilityVital(AbilityProperties ability)
 {
     Debug.Log("3");
     if (ability.Cost > 0)
     {
         //checks if ability is a special or not, determining vital type used.
         if (ability.IsSpecial)
         {
             if (stats.Energy.CurValue > ability.Cost)
             {
                 Debug.Log("Special Ability activated");
                 stats.Energy.CurValue -= ability.Cost;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
         else
         {
             if (stats.Stamina.CurValue > ability.Cost)
             {
                 Debug.Log("Standard Ability activated");
                 stats.Stamina.CurValue -= ability.Cost;
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     else
     {
         Debug.Log("Ability did not activate");
         return(true);
     }
 }
Esempio n. 3
0
    public void Action(int segment)
    {
        // Debug.Log(segment);
        ConfirmationUI.Instance.TurnAction();
        if (segment == 0)
        {
            SelectMovement();
        }
        else
        {
            ActionProperties action = GetAction(segment - 1);
            var weapon = action as WeaponProperties;
            if (weapon != null)
            {
                activeWeapon = weapon;
                SelectedWeapon();
            }
            else
            {
                AbilityProperties ability = action as AbilityProperties;
                switch (ability.Target)
                {
                case AbilityProperties.TargetType.Self: break;

                case AbilityProperties.TargetType.SelfAOE: break;

                case AbilityProperties.TargetType.Ally: break;

                case AbilityProperties.TargetType.AllyAOE: break;

                case AbilityProperties.TargetType.Enemy: break;

                case AbilityProperties.TargetType.EnemyAOE: break;

                case AbilityProperties.TargetType.All: break;
                }
            }
        }
    }
 /// <summary>
 /// Checks the ability vital, making sure there's enough to activate the ability.
 /// </summary>
 /// <returns><c>true</c>, if ability vital has enough to activate, <c>false</c> otherwise.</returns>
 /// <param name="ability">Ability.</param>
 private bool CheckAbilityVital(AbilityProperties ability)
 {
     Debug.Log ("3");
     if (ability.Cost > 0) {
         //checks if ability is a special or not, determining vital type used.
         if (ability.IsSpecial) {
             if (stats.Energy.CurValue > ability.Cost) {
                 Debug.Log ("Special Ability activated");
                 stats.Energy.CurValue -= ability.Cost;
                 return true;
             } else
                 return false;
         } else {
             if (stats.Stamina.CurValue > ability.Cost) {
                 Debug.Log ("Standard Ability activated");
                 stats.Stamina.CurValue -= ability.Cost;
                 return true;
             } else
                 return false;
         }
     } else {
         Debug.Log ("Ability did not activate");
         return true;
     }
 }
 public bool MonitorAbilityVital(AbilityProperties ability)
 {
     if (ability.Cost > 0) {
         if (ability.UserVital.CurValue >= ability.Cost) {
             ability.UserVital.CurValue -= ability.Cost * Time.deltaTime;
             //				StartCoroutine (ability.UserVital.PauseRegen());
             return true;
         } else
             Debug.LogWarning ("Not enough points in vital");
         return false;
     } else {
         Debug.LogWarning ("Ability has no cost");
         return true;
     }
 }
Esempio n. 6
0
    // Read all ability properties from the JSON file and populate the abilities dictionary.
    void EnumerateProperties()
    {
        string file_name = Application.streamingAssetsPath + "/abilities.json";

        JsonData abilities_data = JsonMapper.ToObject(File.ReadAllText(file_name));

        ability_properties_dictionary = new Dictionary <string, AbilityProperties>();

        var keys = JHelper.GetObjectKeys(abilities_data);

        for (int index = 0; index < abilities_data.Count; ++index)
        {
            var    elem            = abilities_data[index];
            string projectile_name = keys[index];

            AbilityProperties properties = new AbilityProperties();

            if (elem.Keys.Contains("projectile"))
            {
                properties.projectile = projectile_dictionary[(string)elem["projectile"]];
            }

            if (elem.Keys.Contains("audio_clip"))
            {
                properties.audio_clip = audio_dictionary[(string)elem["audio_clip"]];
            }

            if (elem.Keys.Contains("cooldown"))
            {
                properties.cooldown = float.Parse(elem["cooldown"].ToString());
            }

            if (elem.Keys.Contains("lifetime"))
            {
                properties.lifetime = float.Parse(elem["lifetime"].ToString());
            }

            if (elem.Keys.Contains("damage"))
            {
                properties.damage = int.Parse(elem["damage"].ToString());
            }

            if (elem.Keys.Contains("effect_radius"))
            {
                properties.effect_radius = float.Parse(elem["effect_radius"].ToString());
            }

            if (elem.Keys.Contains("knockback_force"))
            {
                properties.knockback_force = float.Parse(elem["knockback_force"].ToString()) * 1000;
            }

            if (elem.Keys.Contains("stun_duration"))
            {
                properties.stun_duration = float.Parse(elem["stun_duration"].ToString());
            }

            if (elem.Keys.Contains("projectile_speed"))
            {
                properties.projectile_speed = float.Parse(elem["projectile_speed"].ToString());
            }

            if (elem.Keys.Contains("camera_shake_strength"))
            {
                properties.camera_shake_strength = float.Parse(elem["camera_shake_strength"].ToString());
            }

            if (elem.Keys.Contains("camera_shake_duration"))
            {
                properties.camera_shake_duration = float.Parse(elem["camera_shake_duration"].ToString());
            }

            ability_properties_dictionary.Add(projectile_name, properties);
        }
    }