当前位置: 首页>>代码示例>>C#>>正文


C# ISFSObject.GetFloat方法代码示例

本文整理汇总了C#中ISFSObject.GetFloat方法的典型用法代码示例。如果您正苦于以下问题:C# ISFSObject.GetFloat方法的具体用法?C# ISFSObject.GetFloat怎么用?C# ISFSObject.GetFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISFSObject的用法示例。


在下文中一共展示了ISFSObject.GetFloat方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetSFSTransform

    public static Vector3 GetSFSTransform(ISFSObject data)
    {
        float x = data.GetFloat("x");
        float y = data.GetFloat("y");
        float z = data.GetFloat("z");

        return new Vector3(x,y,z);
    }
开发者ID:Daminvar,项目名称:Scatterblocks,代码行数:8,代码来源:NetworkHelper.cs

示例2: GetSFSRotation

    public static Vector3 GetSFSRotation(ISFSObject data)
    {
        float rx = data.GetFloat("rx");
        float ry = data.GetFloat("ry");
        float rz = data.GetFloat("rz");

        return new Vector3(rx, ry, rz);
    }
开发者ID:Daminvar,项目名称:Scatterblocks,代码行数:8,代码来源:NetworkHelper.cs

示例3: eseguiAnimazioniRemoteT

 //esegue animazioni remote Tastiera
 public void eseguiAnimazioniRemoteT(ISFSObject sfsObjIn)
 {
     anim.SetFloat("Forward",sfsObjIn.GetFloat("f"));
     anim.SetFloat("Turn", sfsObjIn.GetFloat("t"));
     anim.SetBool("OnGround", sfsObjIn.GetBool("o"));
     anim.SetFloat("Jump", sfsObjIn.GetFloat("j"));
     anim.SetFloat("JumpLeg", sfsObjIn.GetFloat("jL"));
     anim.SetBool("Attacco1", sfsObjIn.GetBool("a1"));
     anim.SetBool("Attacco2", sfsObjIn.GetBool("a2"));
 }
开发者ID:LucaGames,项目名称:ClassPrjUnit4-5,代码行数:11,代码来源:AnimSyncronizeRiceiver.cs

示例4: fromSFSObject

 public void fromSFSObject(ISFSObject estimacion)
 {
     user = estimacion.GetUtfString("user");
     valorEstimacion = estimacion.GetFloat("valorEstimacion");
     descripcion = estimacion.GetUtfString("descripcion");
     id_UserStory = estimacion.GetLong("id_Story");
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:7,代码来源:Estimacion.cs

示例5: GetFloat

 public float GetFloat(ISFSObject data, string key)
 {
     if (receiveEncrypted)
     {
         return provider.DecryptFloat(data.GetByteArray(key));
     }
     else
     {
         return data.GetFloat(key);
     }
 }
开发者ID:Antaresgames,项目名称:AegisBorn,代码行数:11,代码来源:ReceivableObject.cs

示例6: HandleResponse

        public void HandleResponse(ISFSObject anObjectIn, GameWorldManager ourGWM)
        {
            string aCharacterName = anObjectIn.GetUtfString("CharacterName");
            if(aCharacterName == ourGWM.getLPC().GetName())
            {
                return;
            }
            else if(ourGWM.getPlayerDictionary().ContainsKey(aCharacterName))
            {
                float Rotation = anObjectIn.GetFloat("Rotation");

                ourGWM.getPlayerDictionary()[aCharacterName].GetComponent<RemotePlayerController>().SetRotation(Rotation);
            }
        }
开发者ID:Gabe-Biele,项目名称:Project-Circleage,代码行数:14,代码来源:RotationUpdateHandler.cs

示例7: HandleResponse

        public void HandleResponse(ISFSObject anObjectIn, GameWorldManager ourGWM)
        {
            Debug.Log("Server spawning player.");
            float[] locationArray = anObjectIn.GetFloatArray("Location");
            float aRotation = anObjectIn.GetFloat("Rotation");
            string aCharacterName = anObjectIn.GetUtfString("CharacterName");

            if(anObjectIn.GetBool("IsLocal"))
            {
                GameObject aLocalPlayer = ourGWM.createObject("Prefabs/Player/PlayerBasic");
                aLocalPlayer.transform.position = new Vector3(locationArray[0], locationArray[1], locationArray[2]);
                aLocalPlayer.transform.rotation = Quaternion.identity;

                // Since this is the local player, lets add a controller and fix the camera
                aLocalPlayer.AddComponent<LocalPlayerController>();
                aLocalPlayer.AddComponent<InputController>();
                ourGWM.setLPC(aLocalPlayer.GetComponent<LocalPlayerController>());
                ourGWM.getLPC().SetName(aCharacterName);
                aLocalPlayer.GetComponentInChildren<TextMesh>().text = aCharacterName;

                GameObject cameraAttach = new GameObject();
                cameraAttach.transform.parent = aLocalPlayer.transform;
                cameraAttach.transform.localPosition = new Vector3(1f, 2.5f, 1.0f);
                cameraAttach.name = "Camera Target";
                Camera.main.transform.parent = cameraAttach.transform;
                Camera.main.GetComponent<CameraController>().setTarget(cameraAttach);
                Camera.main.GetComponent<CameraController>().setCursorVisible(false);
            }
            else if(!anObjectIn.GetBool("IsLocal"))
            {
                GameObject aRemotePlayer = ourGWM.createObject("Prefabs/Player/PlayerBasic");

                aRemotePlayer.name = "GameCharacter_" + aCharacterName;
                aRemotePlayer.AddComponent<RemotePlayerController>();
                aRemotePlayer.transform.position = new Vector3(locationArray[0], locationArray[1], locationArray[2]);
                aRemotePlayer.GetComponent<RemotePlayerController>().SetRotation(aRotation);
                aRemotePlayer.GetComponentInChildren<TextMesh>().text = aCharacterName;

                //Add Newly spawned player to Dictionary
                ourGWM.getPlayerDictionary().Add(aCharacterName, aRemotePlayer);
            }
        }
开发者ID:Gabe-Biele,项目名称:Project-Circleage,代码行数:42,代码来源:SpawnPlayerHandler.cs

示例8: eseguiAnimazioniRemoteC

 //esegue animazioni remote Punta e clicca
 public void eseguiAnimazioniRemoteC(ISFSObject sfsObjIn)
 {
     forward= sfsObjIn.GetFloat("f");
     attacco1=sfsObjIn.GetBool("a1");
     attacco2=sfsObjIn.GetBool("a2");
 }
开发者ID:LucaGames,项目名称:ClassPrjUnit4-5,代码行数:7,代码来源:AnimSyncronizeRiceiver.cs

示例9: recieveExplosionForce

    private void recieveExplosionForce(ISFSObject msg)
    {
        var force = msg.GetFloat("force");
        var pos = msg.GetFloatArray("pos");
        var team = msg.GetUtfString("team");
        targetPosition = new Vector3(pos[0], Y_PLANE, pos[1]);

        GameObject newExplosion = Instantiate(ExplosionPF, targetPosition, Quaternion.identity) as GameObject;

        if (team == "blue")
        {
            newExplosion.GetComponent<ParticleSystem>().startColor = new Color(0.0f, 0.5f, 1.0f, 1.0f);
        }
        else
        {
            newExplosion.GetComponent<ParticleSystem>().startColor = Color.red;
        }

        Vector3 lightPosition = targetPosition;
        lightPosition.y += 10.0f;

        GameObject explosionLight = Instantiate(ExplosionLightPF, lightPosition, Quaternion.identity) as GameObject;

        if (team == "blue")
        {
            explosionLight.GetComponent<Light>().color = Color.blue;
        }
        else
        {
            explosionLight.GetComponent<Light>().color = Color.red;
        }

        float totalTime = 2.0f * force/160.0f;

        Destroy(newExplosion, totalTime);

        totalTime = totalTime/5.0f;

        Destroy(explosionLight, totalTime);

        GameObject[] blocksArray = GameObject.FindGameObjectsWithTag("Block");
        foreach (GameObject block in blocksArray)
        {
            if (block.GetComponent<BoxCollider>().bounds.Contains(targetPosition))
            {
                var extents = block.GetComponent<BoxCollider>().bounds.extents;
                if(targetPosition.x > block.transform.position.x)
                    targetPosition += new Vector3(extents.x, 0, 0);
                else
                    targetPosition -= new Vector3(extents.x, 0, 0);

                if(targetPosition.z > block.transform.position.z)
                    targetPosition += new Vector3(0, 0, extents.z);
                else
                    targetPosition -= new Vector3(0, 0, extents.z);
            }

            block.GetComponent<Rigidbody>().AddExplosionForce(force, targetPosition, 25.0f, 0.0f, ForceMode.Impulse);
        }
    }
开发者ID:Daminvar,项目名称:Scatterblocks,代码行数:60,代码来源:GameManager.cs

示例10: UpdatePolicePosition

 private void UpdatePolicePosition(ISFSObject data)
 {
     float police_x = (float)data.GetFloat("police_x");
     float police_y = (float)data.GetFloat("police_y");
     currentPolice.transform.position = new Vector3(police_x * mg.getScale().x, (police_y * mg.getScale().y + 0.2F * mg.getScale().y), 2F);
 }
开发者ID:Hargalaten,项目名称:meGAMEss,代码行数:6,代码来源:NetworkManager.cs

示例11: updateInterpolationData

    private void updateInterpolationData(ISFSObject obj)
    {
        Vector3 nTrans = NetworkHelper.GetSFSTransform(obj);
        Vector3 nAngle = NetworkHelper.GetSFSRotation(obj);

        if (firstUpdate)
        {
            mostRecentTrans = nTrans;
            mostRecentAngle = nAngle;
            firstUpdate = false;
        }

        // Store last trans
        lastTransform = mostRecentTrans;

        // Store last angle
        lastAngle = mostRecentAngle;

        mostRecentAngle = nAngle;

        prevTime = mostRecentTime;

        mostRecentTrans = nTrans;

        mostRecentTime = obj.GetFloat("time");

        distanceDelta.x = (mostRecentTrans.x - lastTransform.x)/(mostRecentTime - prevTime);
        distanceDelta.y = (mostRecentTrans.y - lastTransform.y)/(mostRecentTime - prevTime);
        distanceDelta.z = (mostRecentTrans.z - lastTransform.z)/(mostRecentTime - prevTime);

        // Need to prevent issues from angle differences larger than 180
        if ( Math.Abs(mostRecentAngle.x - lastAngle.x) > 180.0f)
        {
            if (mostRecentAngle.x < lastAngle.x)
            {
                mostRecentAngle.x = mostRecentAngle.x + 360.0f;
            }
            else
            {
                lastAngle.x = lastAngle.x + 360.0f;
            }
        }

        if ( Math.Abs(mostRecentAngle.y - lastAngle.y) > 180.0f)
        {
            if (mostRecentAngle.y < lastAngle.y)
            {
                mostRecentAngle.y = mostRecentAngle.y + 360.0f;
            }
            else
            {
                lastAngle.y = lastAngle.y + 360.0f;
            }
        }

        if ( Math.Abs(mostRecentAngle.z - lastAngle.z) > 180.0f)
        {
            if (mostRecentAngle.z < lastAngle.z)
            {
                mostRecentAngle.z = mostRecentAngle.z + 360.0f;
            }
            else
            {
                lastAngle.z = lastAngle.z + 360.0f;
            }
        }

        angleDelta = (mostRecentAngle - lastAngle)/(mostRecentTime - prevTime);

        lastAngle = FixAngles(lastAngle);
        mostRecentAngle = FixAngles(mostRecentAngle);
    }
开发者ID:Daminvar,项目名称:Scatterblocks,代码行数:72,代码来源:Robot.cs

示例12: CreateNewGameObject

    public void CreateNewGameObject(ISFSObject obj)
    {
        string id = obj.GetUtfString("Id");

        //parse id to determine type
        string[] temp = id.Split('-');
        //Debug.Log(temp[0] + " " + temp[1] + " " + temp[2]);

        int type = int.Parse(temp[1]);

        GameObject newObject;

        //Debug.Log("Make new stuff");

        switch (type)
        {
            case 00: //tank
                Vector3 pos = new Vector3(obj.GetFloat("px"), obj.GetFloat("py"), obj.GetFloat("pz"));
                newObject = (GameObject)Instantiate(OtherPlayerTankPrefab, pos, Quaternion.identity);
                newObject.GetComponent<InputController>().id = temp[0];
                newObject.GetComponent<NetTag>().Id = temp[0] + "-00-" + "00";
                GameObject.FindWithTag("MainCamera").GetComponent<MainCameraScript>().setEnemies();
                GameObject.FindWithTag("MapCamera").GetComponent<MapCameraScript>().setEnemies();
                updatePhysList();
                break;

            case 1: //projectile
                newObject = (GameObject)Instantiate(heatProjectile, new Vector3(obj.GetFloat("ppx"), obj.GetFloat("ppy"), obj.GetFloat("ppz")), Quaternion.Euler(new Vector3(obj.GetFloat("prx"), obj.GetFloat("pry"), obj.GetFloat("prz"))));
                newObject.rigidbody.velocity = new Vector3(obj.GetFloat("pvx"), obj.GetFloat("pvy"), obj.GetFloat("pvz"));
                newObject.transform.position += newObject.rigidbody.velocity.normalized * 7;
                newObject.GetComponent<NetTag>().Id = temp[0] + "-1-" + temp[2];
                //primaryCount++;
                // Recoil
                /*NetInputController thisRemoteController = GetRemoteController(temp[0] + "-00-" + "00");
                thisRemoteController.Hull.rigidbody.AddForceAtPosition(-newObject.rigidbody.velocity * newObject.rigidbody.mass, thisRemoteController.Turret.Muzzle.transform.position, ForceMode.Impulse);*/
                updatePhysList();
                //Debug.Log("Spawning New Projectile with ID: " + newObject.GetComponent<NetTag>().Id);
                break;

            case 2: //missile
                newObject = (GameObject)Instantiate(ATMissile, new Vector3(obj.GetFloat("ppx"),obj.GetFloat("ppy"),obj.GetFloat("ppz")), Quaternion.Euler(new Vector3(obj.GetFloat("prx"),obj.GetFloat("pry"),obj.GetFloat("prz"))));
                newObject.GetComponent<GuidedProjectileInputController>().TargetPosition = new Vector3(obj.GetFloat("tx"), obj.GetFloat("ty"), obj.GetFloat("tz")); //ATMissile
                newObject.rigidbody.velocity = new Vector3(obj.GetFloat("pvx"), obj.GetFloat("pvy"), obj.GetFloat("pvz")); //ATMissile
                newObject.transform.position += newObject.rigidbody.velocity.normalized * 7;
                newObject.GetComponent<NetTag>().Id = temp[0] + "-2-" + temp[2];
                //secondaryCount++;
                updatePhysList();
                //Debug.Log("Spawning New Missile with ID: " + newObject.GetComponent<NetTag>().Id);
                break;

            default:
                //Debug.Log("Type was: " + type);
                break;
        }
    }
开发者ID:Rabenvald,项目名称:Heavy-Insertion,代码行数:55,代码来源:Manager.cs


注:本文中的ISFSObject.GetFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。