Role Play Attributes View on Asset Store (opens in new tab)

Package details

Latest version
0.1.1
Last updated
First released
Unity version
2021.3.1 or later
Package size
347 KB
Files
49
Favorites
55
Views in the past week
5

Price tracking

Last checked
Tracked since
Lowest recorded
Free on

Keywords

Role Play Attributes

by Seawisp Hunter, LLC (opens in new tab)

No ratings yet

Defines role playing attributes like "max health" using generics that can be modified non-destructively and notify on changes.

Price Free

Get it free on Asset Store (opens in new tab)

Affiliate link · Purchases support this site

Price history

Last 6 months

USD
Price history for Role Play Attributes, 6 months Current Free; lowest Free; highest Free in this period. $0 Jun Jul Aug Sep Oct Nov

Asset preview

1 / 7

Role Play Attributes screenshot 1

Role Play Attributes screenshot 1

About this asset

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<T>. 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.

From the publisher's Asset Store listing.

Technical details

Features

  • C# Interface Based

The 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 Generics

Too 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 Math

Many 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>(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 Modifiers

Sure, 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 Scene

This 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.

Supports

  • Unity 2021.3 and later