public override void InitializeAgent()
    {
        m_JdController = GetComponent <JointDriveController>();
        m_JdController.SetupBodyPart(hips);
        m_JdController.SetupBodyPart(chest);
        m_JdController.SetupBodyPart(spine);
        m_JdController.SetupBodyPart(head);
        m_JdController.SetupBodyPart(thighL);
        m_JdController.SetupBodyPart(shinL);
        m_JdController.SetupBodyPart(footL);
        m_JdController.SetupBodyPart(thighR);
        m_JdController.SetupBodyPart(shinR);
        m_JdController.SetupBodyPart(footR);
        m_JdController.SetupBodyPart(armL);
        m_JdController.SetupBodyPart(forearmL);
        m_JdController.SetupBodyPart(handL);
        m_JdController.SetupBodyPart(armR);
        m_JdController.SetupBodyPart(forearmR);
        m_JdController.SetupBodyPart(handR);

        m_HipsRb  = hips.GetComponent <Rigidbody>();
        m_ChestRb = chest.GetComponent <Rigidbody>();
        m_SpineRb = spine.GetComponent <Rigidbody>();

        m_ResetParams = Academy.Instance.FloatProperties;

        SetResetParameters();
    }
Example #2
0
 // スタート時に呼ばれる
 public override void Initialize()
 {
     SettingRewards = new SettingReward();
     curic          = 0; //ぶつからないだけでRewardのパターン
     curriculum     = SideChannelUtils.GetSideChannel <FloatPropertiesChannel>();
     current_speed  = 0.3f;
 }
Example #3
0
    public override void Initialize()
    {
        m_Rb      = gameObject.GetComponent <Rigidbody>();
        m_LookDir = Vector3.zero;

        m_ResetParams = SideChannelUtils.GetSideChannel <FloatPropertiesChannel>();

        SetResetParameters();
    }
    public override void InitializeAgent()
    {
        m_Rb      = gameObject.GetComponent <Rigidbody>();
        m_LookDir = Vector3.zero;

        m_ResetParams = Academy.Instance.FloatProperties;

        SetResetParameters();
    }
Example #5
0
    public override void Initialize()
    {
        m_WallJumpSettings = FindObjectOfType <WallJumpSettings>();
        m_Configuration    = Random.Range(0, 5);

        m_AgentRb         = GetComponent <Rigidbody>();
        m_ShortBlockRb    = shortBlock.GetComponent <Rigidbody>();
        m_SpawnAreaBounds = spawnArea.GetComponent <Collider>().bounds;
        m_GroundRenderer  = ground.GetComponent <Renderer>();
        m_GroundMaterial  = m_GroundRenderer.material;

        spawnArea.SetActive(false);

        m_FloatProperties = SideChannelUtils.GetSideChannel <FloatPropertiesChannel>();
    }
        public void TestFloatPropertiesSideChannel()
        {
            var k1        = "gravity";
            var k2        = "length";
            int wasCalled = 0;

            var propA        = new FloatPropertiesChannel();
            var propB        = new FloatPropertiesChannel();
            var dictReceiver = new Dictionary <Guid, SideChannel> {
                { propA.ChannelId, propA }
            };
            var dictSender = new Dictionary <Guid, SideChannel> {
                { propB.ChannelId, propB }
            };

            propA.RegisterCallback(k1, f => { wasCalled++; });
            var tmp = propB.GetPropertyWithDefault(k2, 3.0f);

            Assert.AreEqual(tmp, 3.0f);
            propB.SetProperty(k2, 1.0f);
            tmp = propB.GetPropertyWithDefault(k2, 3.0f);
            Assert.AreEqual(tmp, 1.0f);

            byte[] fakeData = SideChannelUtils.GetSideChannelMessage(dictSender);
            SideChannelUtils.ProcessSideChannelData(dictReceiver, fakeData);

            tmp = propA.GetPropertyWithDefault(k2, 3.0f);
            Assert.AreEqual(tmp, 1.0f);

            Assert.AreEqual(wasCalled, 0);
            propB.SetProperty(k1, 1.0f);
            Assert.AreEqual(wasCalled, 0);
            fakeData = SideChannelUtils.GetSideChannelMessage(dictSender);
            SideChannelUtils.ProcessSideChannelData(dictReceiver, fakeData);
            Assert.AreEqual(wasCalled, 1);

            var keysA = propA.ListProperties();

            Assert.AreEqual(2, keysA.Count);
            Assert.IsTrue(keysA.Contains(k1));
            Assert.IsTrue(keysA.Contains(k2));

            var keysB = propA.ListProperties();

            Assert.AreEqual(2, keysB.Count);
            Assert.IsTrue(keysB.Contains(k1));
            Assert.IsTrue(keysB.Contains(k2));
        }
    public override void InitializeAgent()
    {
        m_AgentRb = GetComponent <Rigidbody>();
        m_BallRb  = ball.GetComponent <Rigidbody>();
        var        canvas = GameObject.Find(k_CanvasName);
        GameObject scoreBoard;

        m_ResetParams = Academy.Instance.FloatProperties;
        if (invertX)
        {
            scoreBoard = canvas.transform.Find(k_ScoreBoardBName).gameObject;
        }
        else
        {
            scoreBoard = canvas.transform.Find(k_ScoreBoardAName).gameObject;
        }
        m_TextComponent = scoreBoard.GetComponent <Text>();
        SetResetParameters();
    }
Example #8
0
    public void Start()
    {
        m_ResetParameters = Academy.Instance.FloatProperties;

        m_Objects = new[] { goalPref, pitPref };

        m_AgentCam = transform.Find("agentCam").GetComponent <Camera>();

        actorObjs = new List <GameObject>();

        var sceneTransform = transform.Find("scene");

        m_Plane           = sceneTransform.Find("Plane").gameObject;
        m_Sn              = sceneTransform.Find("sN").gameObject;
        m_Ss              = sceneTransform.Find("sS").gameObject;
        m_Sw              = sceneTransform.Find("sW").gameObject;
        m_Se              = sceneTransform.Find("sE").gameObject;
        m_InitialPosition = transform.position;
    }
        public void TestFloatPropertiesSideChannel()
        {
            var k1        = "gravity";
            var k2        = "length";
            int wasCalled = 0;

            var propA        = new FloatPropertiesChannel();
            var propB        = new FloatPropertiesChannel();
            var dictReceiver = new Dictionary <Guid, SideChannel> {
                { propA.ChannelId, propA }
            };
            var dictSender = new Dictionary <Guid, SideChannel> {
                { propB.ChannelId, propB }
            };

            propA.RegisterCallback(k1, f => { wasCalled++; });
            var tmp = propB.GetPropertyWithDefault(k2, 3.0f);

            Assert.AreEqual(tmp, 3.0f);
            propB.SetProperty(k2, 1.0f);
            tmp = propB.GetPropertyWithDefault(k2, 3.0f);
            Assert.AreEqual(tmp, 1.0f);

            byte[] fakeData = RpcCommunicator.GetSideChannelMessage(dictSender);
            RpcCommunicator.ProcessSideChannelData(dictReceiver, fakeData);

            tmp = propA.GetPropertyWithDefault(k2, 3.0f);
            Assert.AreEqual(tmp, 1.0f);

            Assert.AreEqual(wasCalled, 0);
            propB.SetProperty(k1, 1.0f);
            Assert.AreEqual(wasCalled, 0);
            fakeData = RpcCommunicator.GetSideChannelMessage(dictSender);
            RpcCommunicator.ProcessSideChannelData(dictReceiver, fakeData);
            Assert.AreEqual(wasCalled, 1);
        }
 public override void Initialize()
 {
     m_BallRb      = ball.GetComponent <Rigidbody>();
     m_ResetParams = SideChannelUtils.GetSideChannel <FloatPropertiesChannel>();
     SetResetParameters();
 }
Example #11
0
 public override void Initialize()
 {
     m_BallRb      = ball.GetComponent <Rigidbody>();
     m_ResetParams = Academy.Instance.FloatProperties;
     SetResetParameters();
 }