This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

geckoo

Moderators
  • Content count

    2,084
  • Joined

  • Last visited

Everything posted by geckoo

  1. Hi all! I have a little problem with this code, trying to get the name of the next scene which is really in the build settings : string lvlx = GetNextSceneName(); string GetNextSceneName() { // current scene index int activeSceneBuildIndex = SceneManager.GetActiveScene().buildIndex; // check if there is another scene after this one if (activeSceneBuildIndex + 1 < SceneManager.sceneCountInBuildSettings) return SceneManager.GetSceneByBuildIndex(activeSceneBuildIndex + 1).name; // get the name? else // no more scene return string.Empty; } My string is always null. Have you an idea?
  2. Of course I read this explanation, but my request was a little bit different. As I said I would like to get only the name of the next scene executing this code in the previous. I guess that for a security permission (or something else) it is not possible to do that. I changed this code for something more efficient. Тем не менее, спасибо за поддержку ++
  3. I almost forgot this game, but its development continues. I love this aesthetic and the soundtrack. Take a look at the new video ++
  4. Desync - it hurts my eyes Gameplay looks interesting ++ http://www.desync-game.com/#fpsaction
  5. I would like to understand why this code doesn't work : Debug.Log(SceneManager.GetSceneByBuildIndex(SceneManager.GetActiveScene().buildIndex + 1).name); However this one works : Debug.Log(SceneManager.GetSceneByBuildIndex(SceneManager.GetActiveScene().buildIndex).name); We cannot increment buildIndex :/
  6. ggj17

    To destroy a gameobject, use simply Destroy and use OnTriggerEnter to check collision. However you must have a rigidbody : https://docs.unity3d.com/ScriptReference/Object.Destroy.html https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnTriggerEnter.html
  7. ggj17

    And the theme for the GGJ 2017 is WAVES. Hum... Interesting. I guess that will be many games with zombies or monsters waves
  8. All is in the title - I need someone to test one level for my new project. This is just an alpha. As usual, I like it but I don't want to waste my time trying to do something, if the player could hate the main gameplay. One level - one concept. This is a puzzle game in a first person view. Be rude and frank plz. Send me a private message if you are disposed to help me - and if you have a few minutes in order to write a solid feedback. Thank you ++
  9. This shader has been developed trying to create a distortion, and by writing pattern in a string- however instead you could use a simple picture. There is a feature which allows to chose a global aesthetic - hard or midpoint. I think that it could be useful in order to create an underwater effect or something else. As usual I use the same functions so as to keep a clean code. I hope you like ++ code C# using UnityEngine; [ExecuteInEditMode] [RequireComponent (typeof(Camera))] public class MechanicalDistortion : MonoBehaviour { [Range(-1.0f, 1.0f)] public float _speedX = 0.5f; [Range(-1.0f, 1.0f)] public float _speedY = -0.5f; [Range(0.0f, 5.0f)] public float _strength = 2.0f; public enum filterMode { Point, Bilinear, Trilinear }; public filterMode _filterMode; string[] normalMap = new string[] { "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010", "0101010101010101", "1010101010101010" }; Texture2D _normalMap; int width = 16; int height = 16; Camera cam; private Shader mechanicalDistortionShader = null; private Material mechanicalDistortionMaterial = null; bool isSupported = true; void Awake() { CheckResources(); } public bool CheckResources() { mechanicalDistortionShader = Shader.Find("MyShaders/MechanicalDistortion"); mechanicalDistortionMaterial = CheckShader(mechanicalDistortionShader, mechanicalDistortionMaterial); return isSupported; } protected Material CheckShader(Shader s, Material m) { if (s == null) { Debug.Log("Missing shader on " + ToString()); this.enabled = false; return null; } if (s.isSupported == false) { Debug.Log("The shader " + s.ToString() + " is not supported on this platform"); this.enabled = false; return null; } cam = GetComponent<Camera>(); cam.renderingPath = RenderingPath.UsePlayerSettings; m = new Material(s); m.hideFlags = HideFlags.DontSave; if (s.isSupported && m && m.shader == s) return m; return m; } void Start() { _normalMap = new Texture2D(width, height, TextureFormat.ARGB32, false); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (normalMap[j].Substring(i, 1) == "1") _normalMap.SetPixel(i, j, Color.black); else _normalMap.SetPixel(i, j, Color.white); } } _normalMap.Apply(); } void OnDestroy() { #if UNITY_EDITOR DestroyImmediate(mechanicalDistortionMaterial); #else Destroy(mechanicalDistortionMaterial); #endif } void OnRenderImage (RenderTexture source, RenderTexture destination) { if (CheckResources() == false) { Graphics.Blit (source, destination); return; } _normalMap.wrapMode = TextureWrapMode.Repeat; if (_filterMode == filterMode.Point) _normalMap.filterMode = FilterMode.Point; if (_filterMode == filterMode.Bilinear) _normalMap.filterMode = FilterMode.Bilinear; if (_filterMode == filterMode.Trilinear) _normalMap.filterMode = FilterMode.Trilinear; mechanicalDistortionMaterial.SetFloat ("_speedX", _speedX * 2); mechanicalDistortionMaterial.SetFloat ("_speedY", _speedY * 2); mechanicalDistortionMaterial.SetTexture ("_normalMap", _normalMap); mechanicalDistortionMaterial.SetFloat("_strength", _strength); Graphics.Blit(source, destination, mechanicalDistortionMaterial); } } shader Shader "MyShaders/MechanicalDistortion" { Properties { _MainTex ("Base (RGB)", 2D) = "" {} _normaMap("NormalMap", 2D) = "" {} _speedX("Horizontal Speed", float) = 0 _speedY("Vertical Speed", float) = 0 _strength("Strength", float) = 0 } CGINCLUDE #include "UnityCG.cginc" struct v2f { float4 pos : SV_POSITION; float2 uv : TEXCOORD0; }; sampler2D _MainTex; sampler2D _normalMap; float _speedX; float _speedY; float _strength; v2f vert( appdata_img v ) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.uv = v.texcoord.xy; return o; } float4 frag(v2f i) : SV_Target { float2 base = (float2)0; base.x = i.uv.x - _strength/100 * _Time.z * _speedX; base.y = i.uv.y - _strength/100 * _Time.z * _speedY; float2 nm = tex2D(_normalMap, base).rgb; base.x = (i.uv.x + nm.x * _strength/1000); base.y = (i.uv.y + nm.y * _strength/1000); return fixed4(tex2D(_MainTex, base * (1 - nm * _strength/100)).rgb, 1.0f); } ENDCG Subshader { Pass { ZTest Always Cull Off ZWrite Off CGPROGRAM #pragma vertex vert #pragma fragment frag ENDCG } } Fallback off }
  10. There is an interesting asset for free on asset store which shows us how to create a game session using Unet. However yours seems to me very clever - more efficient and with many features. I hope that I can see something soon. Thank you ++
  11. I think that you could have a similar aesthetic using an ASCII shader or a scratch FX, maybe adding a dual tone effect. Also take a look at these fonts : http://www.dafont.com/fr/pixel-point.font http://www.dafont.com/fr/corrupt-pixel.font http://www.dafont.com/fr/pixel-chunker.font http://www.dafont.com/fr/disorient-pixels.font
  12. ggj17

    Oui j'en suis - juste pile poil sur mes congés
  13. ggj17

    I think that you should wait the theme... I had totally forget this event - thank you for that reminder. I wish you the best ++
  14. I would like to recommend you a tool which helps quickly to rotate/move/scale a GameObject. It works really fine. Take a look at this link - LeanTween ++
  15. OK. Show us some updates and news soon. As I said - I wish you the best ++
  16. Hi Piankhy. I think that you are setting the bar too high. Do you know how many people had worked on these projects - just for the design or the code? Don't focus yourself on a game or a project because you like it. You are always in an understanding process. This year you did the Merry Xmas tutorial, but it is just a trial for beginners. Be wise trying to do something easy - and progressivelly you will become a IndieDev. This is my point of view. I wish you the best ++ I loved "I have been designing games in my head for like 12 years"
  17. The shader which he did creating a NoMan's Sky FX was good ++
  18. I understand and I agree with you. I reduced the importance of the code in the main gameplay. I think now that it adds to the (cyber)mood, but it is not necessary to understand it. Furthermore, I comment that code at the end (like a real code) and all is explicit. To display the code on screen, I decided to write something which could be compared with the basic code using on Pico-8. Not too hard ++
  19. Here this is a strange discussion about computer language. Briefly I explain to you my will. In a project, I use a console as an interface in order to allow player to control himself (some features) and the environement. On this console, I display code which the player should understand - if he does an effort Then he ask himself - Should I execute this code or not? At start, I said to myself that I could use C#, but I assume that newbies cannot understand anything - and this way, the most important part of this gameplay is ruined. Finally I decide to synthetize an abstract language - something which could be understandable, but clever, forcing the player to assimilate progressively the main key of this game. I need to do something unclear at first which the player could decipher. As an example : Debug.Mode OPEN~ kernel.get.<Player.script>().(float)forceJump; (float)forceJump = 6.0; (float)newValue = 1.5; kernel.set.<Player.script>().forceJump =* newValue; kernel.inject.<Player.script>(); kernel.get.<Player.script>().(float)forceJump; (float)forceJump = 9.0; Debug.Mode Close~ And this is my question - Do you understand this code?
  20. Without code we cannot help you fixing bugs ++
  21. Another screen shader - something which displays a LCD renderer with flatten colors and noise. For this filter I use the same curve function to create an old TV screen border (take a look at the computer or TV shader). Notice the new parameter _Time which controls noise's displaying. In the main C# script I don't use some Update() section - all is defined in the shader script. You can set the background solid color and the intensity. It can be improved for your own project ++ http://hpics.li/9fe87ca C# script using UnityEngine; [ExecuteInEditMode] [RequireComponent (typeof(Camera))] public class LCD : MonoBehaviour { [Range(0.0f, 2.0f)] public float _contour = 1.0f; [Range(0.0f, 2.0f)] public float _vignette = 1.0f; [Range(0.0f, 1.0f)] public float _intensity = 0.5f; public Color _color = Color.gray; Camera cam; private int _resX; private int _resY; private Shader lcdShader = null; private Material lcdMaterial = null; bool isSupported = true; void Start() { CheckResources(); _resX = Screen.width; _resY = Screen.height; } public bool CheckResources() { lcdShader = Shader.Find("MyShaders/LCD"); lcdMaterial = CheckShader(lcdShader, lcdMaterial); return isSupported; } protected Material CheckShader(Shader s, Material m) { if (s == null) { Debug.Log("Missing shader on " + ToString()); this.enabled = false; return null; } if (s.isSupported == false) { Debug.Log("The shader " + s.ToString() + " is not supported on this platform"); this.enabled = false; return null; } cam = GetComponent<Camera>(); cam.renderingPath = RenderingPath.UsePlayerSettings; m = new Material(s); m.hideFlags = HideFlags.DontSave; if (s.isSupported && m && m.shader == s) return m; return m; } void OnDestroy() { #if UNITY_EDITOR DestroyImmediate(lcdMaterial); #else Destroy(lcdMaterial); #endif } void OnRenderImage (RenderTexture source, RenderTexture destination) { if (CheckResources() == false) { Graphics.Blit (source, destination); return; } cam.backgroundColor = _color; lcdMaterial.SetFloat("_contour", _contour); lcdMaterial.SetFloat("_vignette", _vignette); lcdMaterial.SetFloat("_intensity", _intensity); lcdMaterial.SetInt("_resX", _resX); lcdMaterial.SetInt("_resY", _resY); Graphics.Blit (source, destination, lcdMaterial); } } Shader script Shader "MyShaders/LCD" { Properties { _MainTex ("Base (RGB)", 2D) = "white" {} _contour("Contour Size", float) = 1 _vignette("Vignette Strength", float) = 1 _intensity("Bright Intensity", float) = 0.5 _resX("Screen Resolution X", int) = 1280 _resY("Screen Resolution Y", int) = 720 } CGINCLUDE #include "UnityCG.cginc" sampler2D _MainTex; float _contour; float _vignette; float _intensity; int _resX; int _resY; struct appdata_t { float4 vertex : POSITION; float4 color : COLOR; float2 uv : TEXCOORD0; }; struct v2f { half2 uv : TEXCOORD0; float4 vertex : SV_POSITION; fixed4 color : COLOR; }; v2f vert(appdata_t i) { v2f o; o.vertex = mul(UNITY_MATRIX_MVP, i.vertex); o.uv = i.uv; o.color = i.color; return o; } inline float2 curve(float2 uv) { uv = (uv - 0.5) * 2.0; uv *= 1.1; uv.x *= 1.0 + pow((abs(uv.y) * _contour/7), 2.0); uv.y *= 1.0 + pow((abs(uv.x) * _contour/5), 2.0); uv = (uv / 2.0) + 0.5; uv = uv * 0.92 + 0.039; return uv; } fixed4 frag(v2f i) : COLOR { float2 uv = i.uv.xy; uv = curve(uv); float4 sum = (float4)0; sum = tex2D(_MainTex,float2(uv.x, uv.y)); float x = uv.x * uv.y * _Time * 1000 + 10; // manage time for noise x = fmod(x, 20) * fmod(x, 150); float dx = fmod(x, 0.01f); float3 parasite = (float3)0; parasite = sum.rgb + sum.rgb * saturate(0.001 + dx.xxx * 100); float3 xxx = (float)0; xxx = tex2D(_MainTex, uv + parasite * 1 / 250); float2 sclinesX; sincos(uv.x * _resX, sclinesX.x, sclinesX.y); float2 sclinesY; sincos(uv.y * _resY, sclinesY.x, sclinesY.y); parasite += sum.rgb * float3(sclinesY.x * _intensity, sclinesY.y * _intensity, sclinesY.x * _intensity); parasite += sum.rgb * float3(sclinesX.x * _intensity, sclinesX.y * _intensity, sclinesX.x * _intensity); parasite = lerp(sum, parasite, saturate(_intensity)); float3 col = (float3)0; col.rgb += sum.xyz / parasite.xyz; col.rgb += pow(col.rgb, 1); col.rgb *= col; col.rgb += col; float vignette = (float)0; vignette = (10 * uv.x * uv.y * (1 - uv.x) * (1 - uv.y)); col *= pow(vignette, _vignette / 2); if (uv.x < 0.0 || uv.x > 1.0) col = 0.025; if (uv.y < 0.0 || uv.y > 1.0) col = 0.025; return fixed4(col * xxx, 1.0); } ENDCG SubShader { Pass { ZTest Always Cull Off ZWrite Off CGPROGRAM #pragma vertex vert #pragma fragment frag #pragma fragmentoption ARB_precision_hint_fastest #pragma target 3.0 ENDCG } } fallback off }
  22. A post which has been written in 2012? Don't expect anything Further, at that time, we were using Unity 3.5 - now this project is obviously outdated ++
  23. Puzzle game?