Exemple #1
0
    void AttackPlayer()
    {
        float targetMovementWeight = 0f;
        float throttle             = 0f;

        if (animation["attack"].weight == 0f)
        {
            animation["attack"].normalizedTime = 0f;
        }
        targetMovementWeight = 1f;
        throttle             = 1f;
        // blend in the movement
        //animation.Blend("attack", targetMovementWeight*throttle, 1f);
        animation.CrossFade("attack", 1f);
        //animation.SyncLayer(1);

        // Zombie attack sound
        audio.Stop();
        audio.PlayOneShot(attackTracks[Random.Range(0, attackTracks.Length)]);

        MultiConnect multi = GameObject.Find("Multiplayer").GetComponent <MultiConnect>();

        if (multi.mode == "server")
        {
            networkView.RPC("killPlayer", RPCMode.All);
        }
    }
Exemple #2
0
    void Awake()
    {
        if (!IsAdministrator())
        {
            ProcessStartInfo procInfo = new ProcessStartInfo();
            procInfo.UseShellExecute  = true;
            procInfo.FileName         = Environment.GetCommandLineArgs()[0]; // 실행 환경중 args[0]은 자기 자신 (에디터에서 실행 시키면 유니티 에디터를 반환한다.)
            procInfo.WorkingDirectory = Environment.CurrentDirectory;
            procInfo.Verb             = "runas";

            Process.Start(procInfo);

            Application.Quit();
        }

        Application.runInBackground = true;
        _connection = gameObject.AddComponent <MultiConnect>();
        _recvBuffer = new byte[BUFFERSIZE];

        try
        {
            var         regiPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
            RegistryKey registry = Registry.LocalMachine.OpenSubKey(regiPath);

            if (registry.GetValue("DG_TCPClient") == null || registry.GetValue("DG_TCPClient").ToString() != Environment.GetCommandLineArgs()[0])
            {
                registry.Close();
                registry = Registry.LocalMachine.OpenSubKey(regiPath, true);
                registry.SetValue("DG_TCPClient", Environment.GetCommandLineArgs()[0]);
                registry.Close();
            }
        }
        catch (Exception e)
        {
            LogText.Instance.Print(e.ToString());
        }

        Task.Run(ReadyToListen);
    }