Game Development Reference
In-Depth Information
Listing 56: A script for building blocks that construct a destructible structure
Before diving into the logic of the code, there is a couple of new things to introduce.
First of all, we use the keyword using in line 3 in order to import a new library into our
code. This library is called System. Collection.Generic . The details of the library are not
as much important as knowing how to use it. By bringing this library to our script, we are
able to declare a List , which we do in line 12. The declaration List<Destructible> means
that this list accepts only one type of elements, which is Destructible . Lists are, like arrays,
collections of objects. However, they are dynamic and we can add as much elements to a
list as we need without having to worry about its capacity.
Search WWH ::




Custom Search