Role Play Attributes
Seawisp Hunter, LLC
$0.0
(no ratings)
Date |
Price |
---|---|
日期和时间 |
价钱($) |
01/06(2023) |
0.0 |
11/15(2024) |
0.0 |
Jump AssetStore
Defines role playing attributes like "max health" using generics that can be modified non-destructively and notify on changes.There comes a time when many a gamedev sets out for adventure but first must create their own stat class. That is to say a class which captures a game "stat", or "statistic" for lack of a better word, like health, attack, defense, etc. This one is mine. Oh wait! there is a better word: "attribute." But I don't want to take "attribute" from your game, so I'll call mine IModifiableValue. Consider it a sound building block for you to create your own attribute class.These attributes and their derivatives may affect and be effected by a multitude of transient things, e.g, a sword that bestows an attack advantage; a shield that raises one's defense; a ring that regenerates health. Because of that attributes ought to respect the following requirements:An attribute's value shall be altered non-destructively.Because so many things may alter an attribute, it shall notify us when changed.See sample scene here.FeaturesC# Interface BasedThe heart of this library is defined by a few C# interfaces, making it easier to understand. Also one can substitute their own implementations easily if need be. Supports GenericsToo many libraries decide all attributes must be a float or an int. With this library one can choose which type suits an attribute, and they may still interact with one another.Generic MathMany a library probably shied away from generics because .NET has not had generic math support, i.e., it was not possible to write T Plus(T a, T b) => a + b. The release of .NET 7 will have that support, which this library makes use of. In addition a workaround makes it possible to present the same API with netstandard2.0, which is important for Unity3D compatability.Flexible ModifiersSure, one can add, minus, multiply, and divide their stats, but what about clamping the value? Is it easy to add that feature? With this library one can implement their own modifier or create ad hoc ones easily.Generic RPG Sample SceneThis sample shows how one might structure their attributes and modifiers in a generic RPG mock up. The user interface is responsive. Tooltips show what effects items have, i.e., show their modifiers. Tooltips also show how each attribute is affected by any modifiers. The sword and shield can be equipped and unequipped. The other items can be consumed. Hit 'R' to reset and 'H' to show help.SupportsUnity 2021.3 and later