MingStar.SimUniversity.Game.Game.IsLegalToBuildCampus C# (CSharp) Method

IsLegalToBuildCampus() public method

public IsLegalToBuildCampus ( VertexPosition whereAt, CampusType type ) : bool
whereAt MingStar.SimUniversity.Contract.VertexPosition
type CampusType
return bool
        public bool IsLegalToBuildCampus(VertexPosition whereAt, CampusType type)
        {
            Vertex vertex = Board[whereAt];
            if (vertex == null)
            {
                return false;
            }
            if (type == CampusType.Super)
            {
                return (vertex.Campus != null &&
                        vertex.Campus.Color == CurrentUniversityColor &&
                        vertex.Campus.Type == CampusType.Traditional);
            }
            // tranditional campus
            bool result = vertex.IsFreeToBuildCampus();
            if (CurrentPhase == GamePhase.Play)
            {
                result = result && vertex.Adjacent.Edges.Any(e => e.Color == CurrentUniversityColor);
            }
            return result;
        }