Exemplo n.º 1
0
        public static string GetPrefabName(this RoadItemType roadItemType)
        {
            string prefabName;

            switch (roadItemType)
            {
            case RoadItemType.RedBall:
            case RoadItemType.BlueBall:
            case RoadItemType.YellowBall:
            case RoadItemType.PurpleBall:
                prefabName = "Sphere";
                break;

            case RoadItemType.RedSwitch:
            case RoadItemType.BlueSwitch:
            case RoadItemType.YellowSwitch:
            case RoadItemType.PurpleSwitch:
                prefabName = "ColorSwitch";
                break;

            case RoadItemType.Portal:
                prefabName = "Portal";
                break;

            default:
                throw new NotSupportedException();
            }

            return(prefabName);
        }
Exemplo n.º 2
0
        public static string GetDisolveMaterialName(this RoadItemType roadItemType)
        {
            var materialName        = roadItemType.GetMaterialName();
            var disolveMaterialName = $"{materialName} Disolve";

            return(disolveMaterialName);
        }
Exemplo n.º 3
0
        public static string GetMaterialName(this RoadItemType roadItemType)
        {
            string materialName;

            switch (roadItemType)
            {
            case RoadItemType.RedBall:
            case RoadItemType.BlueBall:
            case RoadItemType.YellowBall:
            case RoadItemType.PurpleBall:
                materialName = $"Ball {roadItemType.ToString().Replace("Ball", "")}";
                break;

            case RoadItemType.RedSwitch:
            case RoadItemType.BlueSwitch:
            case RoadItemType.YellowSwitch:
            case RoadItemType.PurpleSwitch:
                materialName = $"Switch {roadItemType.ToString().Replace("Switch", "")}";
                break;

            case RoadItemType.Portal:
                materialName = null;
                break;

            default:
                throw new NotSupportedException();
            }

            return(materialName);
        }
Exemplo n.º 4
0
        private void ChangeBallColor(RoadItemType ballTypeAfterSwitch)
        {
            var materialName         = ballTypeAfterSwitch.GetMaterialName();
            var roadItemBallMaterial = materials.First(x => x.name == materialName);

            _meshRenderer.material = roadItemBallMaterial;
            CurrentType            = ballTypeAfterSwitch;
        }
Exemplo n.º 5
0
        public static RoadItemType GetSwitchBallType(this RoadItemType roadItemType)
        {
            RoadItemType type;

            switch (roadItemType)
            {
            case RoadItemType.RedSwitch:
            case RoadItemType.BlueSwitch:
            case RoadItemType.YellowSwitch:
            case RoadItemType.PurpleSwitch:
                var typeStr = $"{roadItemType.ToString().Replace("Switch", "")}Ball";
                type = EnumUtils.Parse <RoadItemType>(typeStr);
                break;

            default:
                throw new NotSupportedException();
            }

            return(type);
        }
Exemplo n.º 6
0
        public static int GetLayerValue(this RoadItemType roadItemType)
        {
            int layer;

            switch (roadItemType)
            {
            case RoadItemType.RedSwitch:
            case RoadItemType.BlueSwitch:
            case RoadItemType.YellowSwitch:
            case RoadItemType.PurpleSwitch:
                layer = 9;
                break;

            default:
                layer = 0;
                break;
            }

            return(layer);
        }