| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using Google.Protobuf.Collections; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | public class PrimitiveMeshModel |
| | 7 | | { |
| 0 | 8 | | public static bool operator ==(PrimitiveMeshModel left, PrimitiveMeshModel right) { return Equals(left, right); } |
| 0 | 9 | | public static bool operator !=(PrimitiveMeshModel left, PrimitiveMeshModel right) { return !Equals(left, right); } |
| | 10 | |
|
| | 11 | | public enum Type |
| | 12 | | { |
| | 13 | | Box, |
| | 14 | | Sphere, |
| | 15 | | Plane, |
| | 16 | | Cylinder |
| | 17 | | } |
| | 18 | |
|
| 43 | 19 | | public PrimitiveMeshModel(Type type) |
| | 20 | | { |
| 43 | 21 | | this.type = type; |
| 43 | 22 | | } |
| | 23 | |
|
| | 24 | | public Type type; |
| | 25 | | public float radiusTop; |
| | 26 | | public float radiusBottom; |
| 43 | 27 | | public RepeatedField<float> uvs = new RepeatedField<float>(); |
| | 28 | |
|
| | 29 | | protected bool Equals(PrimitiveMeshModel other) |
| | 30 | | { |
| 70 | 31 | | return type == other.type && radiusTop.Equals(other.radiusTop) && radiusBottom.Equals(other.radiusBottom) && Equ |
| | 32 | | } |
| | 33 | |
|
| | 34 | | public override bool Equals(object obj) |
| | 35 | | { |
| 373 | 36 | | if (ReferenceEquals(null, obj)) |
| 0 | 37 | | return false; |
| 373 | 38 | | if (ReferenceEquals(this, obj)) |
| 303 | 39 | | return true; |
| 70 | 40 | | if (obj.GetType() != this.GetType()) |
| 0 | 41 | | return false; |
| 70 | 42 | | return Equals((PrimitiveMeshModel) obj); |
| | 43 | | } |
| | 44 | |
|
| | 45 | | public override int GetHashCode() |
| | 46 | | { |
| | 47 | | unchecked |
| | 48 | | { |
| 705 | 49 | | int hashCode = (int) type; |
| 705 | 50 | | hashCode = (hashCode * 397) ^ radiusTop.GetHashCode(); |
| 705 | 51 | | hashCode = (hashCode * 397) ^ radiusBottom.GetHashCode(); |
| 705 | 52 | | hashCode = (hashCode * 397) ^ (uvs != null ? uvs.GetHashCode() : 0); |
| 705 | 53 | | return hashCode; |
| | 54 | | } |
| | 55 | | } |
| | 56 | | } |