Jump to content
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,816
  • Joined

  • Last visited

  • Days Won

    155

Everything posted by geckoo

  1. It's what I need. I will create this sendRate value.Thank you for help ++
  2. using UnityEngine; using System.Collections; public class MovementUpdate : MonoBehaviour { private Vector3 lastPosition; private Quaternion lastRotation; private Transform myTransform; // false == Idle // true == Walk private bool anim; public GameObject oSpider; // Use this for initialization void Start () { if(networkView.isMine == true){ myTransform = transform; networkView.RPC("updateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation, anim); } else{ enabled = false; } } // Update is called once per frame void Update () { anim = false; if(Vector3.Distance(myTransform.position, lastPosition) >= 0.05){ anim = true; // run lastPosition = myTransform.position; networkView.RPC("updateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation, anim); } if(Quaternion.Angle(myTransform.rotation, lastRotation) >= 1){ lastRotation = myTransform.rotation; networkView.RPC("updateMovement", RPCMode.OthersBuffered, myTransform.position, myTransform.rotation, anim); } } [RPC] void updateMovement (Vector3 newPosition, Quaternion newRotation, bool anim){ transform.position = newPosition; transform.rotation = newRotation; oSpider.animation.wrapMode = WrapMode.Loop; if(anim == true)oSpider.animation.Play("Run"); else oSpider.animation.Play("Idle"); } } Hi friends. To update movement and animation for each player I modified this script which uses a boolean to define state of entity during game - two animations to start, idle and run (after I want define for each animation an integer). In fact, it works fine, but I asked myself about method. Before continue I wanna ask you about this tip. Personally I like this way because it seems to me very easy to create variation with many animations. It's just my point of view, but you are the masters. What do you think about this? It's efficient or not? Maybe I flood the bandwidth for nothing? Thank for your comments ++
  3. geckoo

    Music Water.

    Really cool effect. You are an artist ++
  4. Thank for this good share...
  5. Thank for the tips. Recently I bought the GTGD on steam for 1.49 euro. I think it's the best tutorial to understand all of NetWorking on Unity. Maybe it would be better to cut some videos because they are too long (sometime 2 hours), but it's a really good package. This is my point of view ++ http://store.steampowered.com/app/269570/
  6. Hi friends. I have some difficult to convert this code from M2H tutorial about NetWork. There is a persistent problem with array. I have find some explanation in the web, but I didn't understand all. I use this script in the MultiKit by TheMars2011. It work fine, but I can't accede to values because all source is in C#. I must convert this code. In fact, I got just one problem - chatEntries = new ArrayList()... Who can help me (us)? Thank you for your help ++ #pragma strict #pragma implicit #pragma downcast public static var usingChat : boolean = false; var skin : GUISkin; var showChat : boolean = false; //Private variable used by the script private var inputField : String= ""; private var scrollPosition : Vector2; private var width : int = 400; private var height : int = 180; private var playerName : String; private var lastUnfocus : float = 0; private var window : Rect; private var chatEntries = new ArrayList(); class FPSChatEntry { var name : String = ""; var text : String = ""; } function Awake() { playerName = PlayerPrefs.GetString("playerName", playerName); usingChat = false; window = Rect(5, 5, width, height); } function CloseChatWindow () { showChat = false; inputField = ""; chatEntries = new ArrayList(); } function ShowChatWindow () { showChat = true; inputField = ""; chatEntries = new ArrayList(); } function OnGUI () { if(!showChat){ return; } GUI.skin = skin; if (Event.current.type == EventType.keyDown && Event.current.character == "\n" && inputField.Length <= 0) { if(lastUnfocus + 0.25 < Time.time){ usingChat = true; GUI.FocusWindow(5); GUI.FocusControl("Chat input field"); } } window = GUI.Window (2, window, GlobalChatWindow, ""); } function GlobalChatWindow (id : int) { for (var entry : FPSChatEntry in chatEntries) { GUILayout.BeginHorizontal(); if(entry.name == ""){//Game message GUILayout.Label (entry.text); }else{ GUILayout.Label (entry.name + ": " + entry.text); } GUILayout.EndHorizontal(); } if (Event.current.type == EventType.keyDown && Event.current.character == "\n" && inputField.Length > 0) { HitEnter(inputField); usingChat = false; GUI.UnfocusWindow ();//Deselect chat } GUI.SetNextControlName("Chat input field"); inputField = GUILayout.TextField(inputField); } function HitEnter(msg : String){ msg = msg.Replace("\\n", " "); networkView.RPC("ApplyGlobalChatText", RPCMode.All, playerName, msg); inputField = ""; //Clear line GUI.UnfocusWindow ();//Deselect chat lastUnfocus = Time.time; GUI.FocusControl(""); //Close chat usingChat = false; } @RPC function ApplyGlobalChatText (name : String, msg : String) { var entry : FPSChatEntry = new FPSChatEntry(); entry.name = name; entry.text = msg; chatEntries.Add(entry); //Remove old entries if (chatEntries.Count > 5){ chatEntries.RemoveAt(0); } } //Add game messages function addGameChatMessage(str : String){ ApplyGlobalChatText("", str); if(Network.connections.length > 0){ networkView.RPC("ApplyGlobalChatText", RPCMode.Others, "", str); } }
  7. public Transform bulletGo; //... Vector3 direction = gameObject.transform.TransformDirection(new Vector3(Random.Range(-0.01f, 0.01f) * spread, Random.Range(-0.01f, 0.01f) * spread, 1)); RaycastHit hit; if (Physics.Raycast(bulletGo.position, direction, out hit, range, hitLayers)){ // bla bla Use Random.Range with your RayCast to create a spread ++
  8. I saw http://armedunity.com/topic/9106-unity-master-server-alternative/#entry80036
  9. Hi folks! It seems to me Unity master server (again) is out today. I read in the M2H tutorial about NetWorking that we can create and set up an own master server. Source available on RakNet site, and for many platforms. Maybe somebody did this tool or uses another alternative? I don't know how we can configure Unity for connect with a second master server. There is a panel somewhere? This problem is really annoying ++
  10. Hum... I tried all versions of this game and It works fine every time without lags. Do you have some errors during game - some explanation? Whats is your Unity version?
  11. geckoo

    Watch here

    In fact, you want a full game if I understand
  12. I found a bug in the 1.51 version of the game. When a player appears in the game after prime connection with the server, it remains suspended in the air. Until the first movement/refresh, it not was in contact with the ground. I have pressed a key and all is perfect. I think we must disable render before first movement. It's just an idea ++
  13. I have never played with a slender game. Maybe soon ++
  14. geckoo

    Best games ever :)

    1-FPS (Black Ops - the first, during cold war and BF3) - Multi (BF3, Day of Deafet or TF2) 2-Strategy Games (rts) - nothing. I hate this. 3-MMORPG - nothing 3- 3rd Person shooter - SpecOp the Line 4- card games - WTF
  15. Yeah. I think too. There's something very different with this weapon, but all weapons are patented. No? Except AK47 maybe...
  16. I see a problem with the french MG FAMAS which is in all modern FPS. It's a summary for "fusil d'assaut de la manufacture de Saint-Etienne". You use the name - you use the brand ++
  17. geckoo

    Mehanium

    it didn't work - never
  18. Strange. It seems to me, TheMars2011 uses a pro version Unity ++
  19. I don't wish to impose on your kindness, but it will be great ++
  20. Hi TheMars2011. I have a question about rakNet1.51 - your last project. I have modified many aspect in your game, but I can't change player. I tryed to change him with the soldier, but without succes. Do you know some tutorial which explains us the method (with MecAnim or not). Thank you for you help friend ++
  21. If I understand correctly, you do a screenshot to create a miniMap - just a picture. Like this, you don't use a second camera. It's a good idea. Misc/MainMenu and Network/Server are similar, but with first you create a most complex menu with options. Second is helpful for a simple project. Cool! All in this code is really interesting for those who want learn about NetWork. Master server seems to me out. I will try this project online soon. I will try to change this player (I restore the soldier without MecAnim - I hate this). I have created two teams, using tag to avoid friendly fire. I have some problem to create a chat because I cannot code an array in C#. It works to define victim and killer for all. I dev another project... Thank you very much for this share ++
  22. I have a question about this code in the script "spawn". I read this part and I don't understand why you declare 3 times boolean "spawned" ++ void SpawnPlayer() { spawned = true; int random = Random.Range(0, spawnPoints.Length); Network.Instantiate(player, spawnPoints[random].position, spawnPoints[random].rotation, 0); spawned = true; spawnCam.enabled = false; spawnListener.enabled = false; spawned = true; Screen.lockCursor = true; }
  23. In this project we got only one weapon and it's not possible pickup AK47 which dead player dropped. It seems to me, it's a really good project with really clear code to start something better with other player/arms and many weapons. I know you. You can do that... То, что невозможно другим, тебе возможно. Твои проекты удивительны ++
  24. It's just a problem with scale of this part. See inspector to fix it ++
×
×
  • Create New...