예제 #1
0
파일: Node.cs 프로젝트: paulius-m/darkcave
        public static NodeType Get(NodeTypes type)
        {
            NodeType o = null;

            switch (type)
            {
                case NodeTypes.Earth:
                    o = new NodeType
                    {
                        Color = new Vector3(.6f, .5f, 0.4f),
                        Texture = new Vector3(0, 0, 0),
                        ResolveCollision = HardCollision,
                        Opacity = 1.0f,
                        Textures = {
                            {"0000", new Vector3(0, 0, 0)},
                            {"1000", new Vector3(0, 1, 0)},
                            {"0100", new Vector3(0, 2, 0)},
                            {"1100", new Vector3(0, 3, 0)},
                            {"0010", new Vector3(0, 4, 0)},
                            {"1010", new Vector3(0, 5, 0)},
                            {"0110", new Vector3(0, 6, 0)},
                            {"1110", new Vector3(0, 7, 0)},
                            {"0001", new Vector3(0, 8, 0)},
                            {"1001", new Vector3(0, 9, 0)},
                            {"0101", new Vector3(0, 10, 0)},
                            {"1101", new Vector3(0, 11, 0)},
                            {"0011", new Vector3(0, 12, 0)},
                            {"1011", new Vector3(0, 13, 0)},
                            {"0111", new Vector3(0, 14, 0)},
                            {"1111", new Vector3(0, 15, 0)},
                        }
                    };
                    break;
                case NodeTypes.Soil:
                    o = new NodeType
                    {
                        Color = new Vector3(.6f, .55f, 0.55f),
                        Texture = new Vector3(13, 0, 0),
                        ResolveCollision = HardCollision,
                        Opacity = 1.0f,
                        Textures = {
                            {"0000", new Vector3(2, 5, 0)},
                            {"1000", new Vector3(2, 5, 0)},
                            {"0100", new Vector3(2, 5, 0)},
                            {"1100", new Vector3(1, 6, 0)},
                            {"0010", new Vector3(2, 5, 0)},
                            {"1010", new Vector3(2, 5, 0)},
                            {"0110", new Vector3(2, 5, 0)},
                            {"1110", new Vector3(2, 5, 0)},
                            {"0001", new Vector3(2, 5, 0)},
                            {"1001", new Vector3(1, 5, 0)},
                            {"0101", new Vector3(2, 5, 0)},
                            {"1101", new Vector3(2, 5, 0)},
                            {"0011", new Vector3(3, 5, 0)},
                            {"1011", new Vector3(2, 5, 0)},
                            {"0111", new Vector3(2, 5, 0)},
                            {"1111", new Vector3(2, 5, 0)},
                        }

                    };
                    break;
                case NodeTypes.Air:
                    o = new NodeType
                    {
                        Color = Vector3.One,
                        Texture = new Vector3(14, 0, 0),
                        CanCollide = false,
                        CanRender = false,
                        //Emission = new Vector3(.1f, .125f, 0.25f),
                    };
                    break;
                case NodeTypes.EarthBack:
                    o = new NodeType
                    {
                        Color = Vector3.One,
                        Texture = new Vector3(14, 0, 0),
                        CanCollide = false,
                        CanRender = true,
                    };
                    break;

                case NodeTypes.Water:
                    o = new AnimatedNode
                    {
                        Animation = new PassiveAnimationSet
                        {
                            Frames = waterAnims.Frames,
                            ActiveAnimation = "0"
                        },
                        CanCollide = true,
                        CanRender = true,
                        //ReflectionAngle = 0.1f,
                        Color = new Vector3(0.5f, 0.5f, 1),
                        Opacity = 0.1f,
                        ResolveCollision = Slowdown,
                    };
                    break;
                case NodeTypes.Lava:
                    o = new AnimatedNode
                    {
                        Animation = new PassiveAnimationSet
                        {
                            Frames = lavaAnims.Frames,
                            ActiveAnimation = "0"
                        },

                        Color = new Vector3(1.0f, 0.3f, 0.0f),
                        ResolveCollision = HardCollision,
                        Opacity = 0.9f,
                        Emission = new Vector3(1f, 0.3f, 0.0f),
                    };
                    break;

                case NodeTypes.Cloud:
                    o = new NodeType
                    {
                        Color = Vector3.One,
                        Texture = new Vector3(15, 15, 0),
                        Opacity = 0.2f,
                        CanCollide = false,
                    };
                    break;
                case NodeTypes.Brick:
                    o = new NodeType
                    {
                        Color = new Vector3(0.9f, 0.9f, 0.9f),
                        Texture = new Vector3(1f, 7f, 0),
                        ResolveCollision = HardCollision,
                        Opacity = 1.0f,
                    };
                    break;
                case NodeTypes.BrickBack:
                    o = new NodeType
                    {
                        CanCollide = false,
                        Texture = new Vector3(2f, 7f, 0),
                        Color = new Vector3(0.6f, 0.6f, 0.5f),
                    };
                    break;
                default:
                    o = new NodeType();

                    o.Color = Vector3.One;
                    o.CanCollide = true;
                    o.ResolveCollision = NodeFactory.HardCollision;
                    o.Opacity = 1;
                    o.Texture = new Vector3(15, 15, 0);
                    break;
            }
            o.Type = type;
            return o;
        }
예제 #2
0
파일: Node.cs 프로젝트: paulius-m/darkcave
        public void SetType(NodeType newType)
        {
            if (Type!= null && Type.Type == newType.Type&& newType.Type != NodeTypes.Custom)
                return;

            newType.OldNodeType = Type;
            Type = newType;

            Type.Init(this);
            if (TypeChanged != null)
                TypeChanged(this);
        }