Skip to content

Instantly share code, notes, and snippets.

@listopad
Created April 20, 2018 20:46
Show Gist options
  • Save listopad/332e6fc53881fddbe79b0b981b71b568 to your computer and use it in GitHub Desktop.
Save listopad/332e6fc53881fddbe79b0b981b71b568 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class Character : MonoBehaviour
{
// Базовое количество жизней
private const int baseHealth = 100;
// Количество жизней персонажа в начале делаем базовым
private static int health = baseHealth;
private static class Skills
{
public static int agility = 10;
private static int strength = 10;
public static int Strength
{
get { return strength; }
/*
* При изменении силы, меняем количество жизней персонажа
* добавляя к нему количество силы (ну или домножать можно)
*/
set
{
strength = value;
health = baseHealth + strength;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment