Ejemplo n.º 1
0
        // For performance.
        public bool Equals(BasicUnit unit)
        {
            if (unit == null)
            {
                return(false);
            }

            // We don't check if Cell.Equals(unit.Cell) to avoid recursion. We also ignore actions.
            return(Facing.Equals(unit.Facing) && Class.Equals(unit.Class));
        }
Ejemplo n.º 2
0
        // Equality override.
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            // If obj can not be cast to BasicUnit.
            BasicUnit unit = obj as BasicUnit;

            if (unit == null)
            {
                return(false);
            }

            // We don't check if Cell.Equals(unit.Cell) to avoid recursion. We also ignore actions.
            return(Facing.Equals(unit.Facing) && Class.Equals(unit.Class));
        }