Need help implementing a design pattern

Hey.
So I’m new to Unity and I’m going to try develop a game for my project in college.
In another course we were asked to apply a Design Pattern to our project. There are some specifications that sort of confuse me as to how they can be done in Unity.
Here is basically what the specification says:

  1. Apply a design pattern
  2. Develop 4 or more classes up to canonical standard
  3. Link some classes using inheritance

For 1, I heard that the Object Pool pattern is quite handy to implement in Unity, and I actually have it sort of working at the moment. The bits that make it harder for me to do are 2 and 3. From what I read, canonical standard classes basically implement Cloneable and Serializable and override the equals method.

I’m basically looking for advice on how I could approach this? I was thinking of having a weapon class that is used for different weapons, with each weapon having a different class that inherit the main weapon, and using the object pool to display a different outputted object each time you use a weapon.
However I’m not too sure how I can make this work in Unity, as it uses Scripts which I’m new to.

I would appreciate any help in the right direction.
Thanks!

How to use scripts in Unity is perhaps the broadest question you could ask. You should take a look at some tutorials and documentation:

http://unity3d.com/learn

You need to not think a “script” is somehow different than what you’re used to. A “script” in Unity just is a class that extends MonoBehaviour class so it can be attached to a game object. One thing to note is that MonoBehaviour is not System.Serializable, so anything that extends it cannot meet the canonical standards requirement (i don’t know what that actually means, i’m just working off of your definition).

But it’s easy to get to a place where you need custom classes in a Unity project, and they work just like the classes you already know. For instance, I need an integer-based Vector3, so I made an IEquatable, Serializable class:

/// <summary>Integer Vector3. Any input floats are rounded to int on the assumption that you meant 0.99999999 as 1.0, not 0.0.</summary>
[System.Serializable]
public class IntV3 : IEquatable<IntV3> {
	public static bool operator ==( IntV3 a, IntV3 b ) {return a.y == b.y && a.x == b.x && a.z == b.z;}
	public static bool    operator!=(IntV3 a, IntV3 b) { 
		return ( a.y!=b.y || a.x!=b.x || a.z!=b.z );
	}
	
	public bool Equals(IntV3 o) {return o.x==x&&o.y==y&&o.z==z;}
	public override int GetHashCode() { return x.GetHashCode() ^ y.GetHashCode() ^ z.GetHashCode(); }
	public override string ToString() { return "("+x+","+y+","+z+")"; }
	public override bool Equals(object obj) { 
		if ( !(obj is IntV3)) return false;
		IntV3 o = (IntV3)obj; return o.x==x&&o.y==y&&o.z==z;
	}
	public int x,y,z;
	
	public IntV3() {x=y=z=0;}
	public IntV3(int a, int b, int c) { x=a;y=b;z=c; }
	public IntV3(float a, float b, float c ) {x=Mathf.RoundToInt(a);y=Mathf.RoundToInt(b);z=Mathf.RoundToInt(c); }
}