Example #1
0
 private void Start()
 {
     rabbitArea    = GetComponentInParent <RabbitArea>();
     egg           = rabbitArea.egg;
     animator      = GetComponent <Animator>();
     rayPerception = GetComponent <RayPerception3D>();
 }
 private void Start()
 {
     ballArea = GetComponentInParent <Ballarea>();
     goal     = ballArea.goal;
     //animator = GetComponent<Animator>();
     rayPerception = GetComponent <RayPerception3D>();
 }
Example #3
0
 private void Start()
 {
     penguinArea   = GetComponentInParent <PenguinArea>();
     baby          = penguinArea.penguinBaby;
     animator      = GetComponent <Animator>();
     rayPerception = GetComponent <RayPerception3D>();
 }
Example #4
0
    public override void InitializeAgent()
    {
        chickenSkin     = GetComponentInChildren <SkinnedMeshRenderer>();
        chickenTr       = GetComponent <Transform>();
        carCollBuffer   = new Collider[16];
        chickCollBuffer = new Collider[16];

        ray = GetComponent <RayPerception3D>();

        roadShuffArrayList = new ArrayList();
        roadShuffArrayList.Add(0);
        roadShuffArrayList.Add(1);
        roadShuffArrayList.Add(2);

        chickPrefab = Resources.Load("Chick") as GameObject;
        carPrefab   = Resources.Load("Car") as GameObject;
        camera      = transform.parent.Find("Camera").gameObject;

        roadBlocks = new RoadBlock[] {
            new RoadBlock(roadBlockTransforms[0]),
            new RoadBlock(roadBlockTransforms[1]),
            new RoadBlock(roadBlockTransforms[2])
        };

        Debug.Log(roadBlocks);

        chickenFirstPos = chickenTr.position;
        foreach (RoadBlock roadBlock in roadBlocks)
        {
            roadBlock.CreateChick(chickPrefab);
            roadBlock.CreateCar(carPrefab);
        }
    }
    public override void InitializeAgent()
    {
        MazeGeneratorArea = GetComponentInParent <MazeGeneratorArea>();
        PlayerGoal        = MazeGeneratorArea.PlayerGoal;
        RayPerception3D   = GetComponent <RayPerception3D>();

        if (CaptureData)
        {
            if (!MazeGeneratorArea.PlayerFileCreated)
            {
                var headings = new List <string>()
                {
                    "PlayerName",
                    "PlayerType",
                    "StepsTrained",
                    "MazeGeneratorName",
                    "AverageScore",
                    "MistakesMade",
                    "LevelsComplted",
                    "Score",
                    "TotalMillisecondsToComplete"
                };
                DataRecorder.WriteRecordToCSV(headings, CSVFilePath);
                MazeGeneratorArea.PlayerFileCreated = true;
            }
        }

        startTime = DateTime.UtcNow;
    }
Example #6
0
 private void Start()
 {
     areaPenguin   = GetComponentInParent <AreaPenguin>();
     baby          = areaPenguin.penguimBebe;
     animator      = GetComponent <Animator>();
     rayPerception = GetComponent <RayPerception3D>();
 }
 public override void InitializeAgent()             //reset되고 실행
 {
     chickenTr = GetComponent <Transform>();        //agent의 위치
     InvokeRepeating("CreateObstacle", 0.5f, 1.0f); //2초뒤에 1.5초마다
     tr  = GetComponent <Transform>();
     rb  = GetComponent <Rigidbody>();
     ray = GetComponent <RayPerception3D>();
 }
Example #8
0
 public override void InitializeAgent()
 {
     base.InitializeAgent();
     rb        = GetComponent <Rigidbody>();
     myArea    = area.GetComponent <CollectorArea>();
     myRayPer  = GetComponent <RayPerception3D>();
     myAcademy = FindObjectOfType <CollectorAcademy>();
 }
Example #9
0
 public override void InitializeAgent()
 {
     wheelVehicle = GetComponent <WheelVehicle> ();
     rigid        = GetComponent <Rigidbody> ();
     rayPer       = GetComponentInChildren <RayPerception3D> ();
     area         = GetComponentInParent <Area> ();
     academy      = FindObjectOfType <RobotArmAcademy> ();
 }
Example #10
0
    private void Start()
    {
        duckPool = GetComponentInParent <DuckPool>();

        animator           = GetComponent <Animator>();
        rayPerception      = GetComponent <RayPerception3D>();
        transform.rotation = Quaternion.Euler(0f, transform.rotation.y, 0f);
    }
Example #11
0
    public override void InitializeAgent()
    {
        base.InitializeAgent();

        tr  = GetComponent <Transform>();
        rb  = GetComponent <Rigidbody>();
        ray = GetComponent <RayPerception3D>();
    }
Example #12
0
 private void Start()
 {
     //initiates essential variables
     pArea         = GetComponentInParent <PenguinArea>();
     baby          = pArea.pBaby;
     animator      = GetComponent <Animator>();
     rayPerception = GetComponent <RayPerception3D>();
 }
Example #13
0
 public override void InitializeAgent()
 {
     base.InitializeAgent();
     battleArea = GetComponentInParent <BattleArea>();
     rayPer     = GetComponent <RayPerception3D>();
     player     = GetComponent <Player>();
     aiAcademy  = FindObjectOfType <AIAcademy>();
 }
 public override void InitializeAgent()
 {
     base.InitializeAgent();
     agentRb = GetComponent <Rigidbody>();
     Monitor.verticalOffset = 1f;
     myArea    = area.GetComponent <BananaArea>();
     rayPer    = GetComponent <RayPerception3D>();
     myAcademy = FindObjectOfType <BananaAcademy>();
 }
Example #15
0
 public override void InitializeAgent()
 {
     base.InitializeAgent();
     rBody            = GetComponent <Rigidbody>();
     robotRay         = GetComponent <RayPerception3D>();
     StartingPosition = transform.position;
     arena            = GetComponentInParent <RobotArea>();
     bestDistance     = Vector3.Distance(transform.position, Target.position);
 }
Example #16
0
    void Start()
    {
        _rb         = transform.GetComponent <Rigidbody>();
        _rayPer     = GetComponent <RayPerception3D>();
        _controller = GetComponent <SimpleCarController>();

        _startPosition = transform.position;
        _startRotation = transform.rotation;
    }
Example #17
0
    private void Awake()
    {
        _spawnPosition = transform.parent;
        _speed         = 15f;
        _rayPerception = GetComponentInChildren <RayPerception3D>();

        _agentSpawner = FindObjectOfType <AgentSpawner>();

        _carAcademy = FindObjectOfType <CarAcademy>();
    }
Example #18
0
 public override void InitializeAgent()
 {
     base.InitializeAgent();
     rocketArea    = GetComponentInParent <RocketArea>();
     rigidbody     = GetComponent <Rigidbody>();
     rayPerception = GetComponent <RayPerception3D>();
     //override the max step set in the inspector
     //max 5000 if training otherwise infinite
     agentParameters.maxStep = rocketArea.trainingMode ? 5000 : 0;
 }
Example #19
0
        public override void InitializeAgent()
        {
            base.InitializeAgent();
            _area          = GetComponentInParent <GameArena>();
            _rigidbody     = GetComponent <Rigidbody>();
            _trail         = GetComponent <TrailRenderer>();
            _rayPerception = GetComponent <RayPerception3D>();

            agentParameters.maxStep = _area.IsTraningMode ? 5000 : 0;
        }
    public override void InitializeAgent()
    {
        base.InitializeAgent();
        m_AgentRb = GetComponent <Rigidbody>();
        Monitor.verticalOffset = 1f;
        m_MyArea    = area.GetComponent <FoodCollectorArea>();
        m_RayPer    = GetComponent <RayPerception3D>();
        m_MyAcademy = FindObjectOfType <FoodCollectorAcademy>();

        SetResetParameters();
    }
        public override void InitializeAgent()
        {
            base.InitializeAgent();
            area          = GetComponentInParent <AircraftArea>();
            rigidbody     = GetComponent <Rigidbody>();
            trail         = GetComponent <TrailRenderer>();
            rayPerception = GetComponent <RayPerception3D>();

            //Override max step set in inspoector
            //Max 5000 if training infinite if racing
            agentParameters.maxStep = area.trainingMode ? 5000 : 0;
        }
Example #22
0
 private void Start()
 {
     forestArea    = GetComponentInParent <ForestArea>();
     animator      = GetComponent <Animation>();
     rayPerception = GetComponent <RayPerception3D>();
     babySound     = forestArea.animalSound;
     penguinSound  = forestArea.dogSound;
     rb            = GetComponent <Rigidbody>();
     safeZone      = forestArea.safeZone;
     safeZone.GetComponent <Animation>().CrossFade("idle");
     saved_id = 0;
 }
Example #23
0
        public void TestPerception3D()
        {
            var angles = new[] { 0f, 90f, 180f };
            var tags   = new[] { "test", "test_1" };

            var             go       = new GameObject("MyGameObject");
            RayPerception3D rayPer3D = go.AddComponent <RayPerception3D>();
            var             result   = rayPer3D.Perceive(1f, angles,
                                                         tags, 0f, 0f);

            Debug.Log(result.Count);
            Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2));
        }
Example #24
0
    private void Start()
    {
        rangeFinders = rangeFinderContainer.GetComponentsInChildren <RangeFinder>();

        cc                = GetComponent <CarController>();
        wcs               = new WheelCollider[] { wheelBL, wheelBR, wheelFL, wheelFR };
        carRigidbody      = GetComponent <Rigidbody>();
        carStartPos       = transform.position;
        carStartRotation  = transform.rotation;
        carRigidbody.mass = CarWeight;
        rayPerception     = GetComponent <RayPerception3D>();
        lastTime          = Time.time;
        AddReward(-.5f);
    }
Example #25
0
    // Start is called before the first frame update
    public override void InitializeAgent()
    {
        base.InitializeAgent();
        agentRb     = GetComponent <Rigidbody>();
        rayPer      = GetComponent <RayPerception3D>();
        HealthAgent = GetComponent <HealthAgent>();

        FloatVariable health = ScriptableObject.CreateInstance <FloatVariable>();

        health.InitialValue = InitialHealth;
        health.RuntimeValue = InitialHealth;
        HealthAgent.Health  = health;

        Academy = GameObject.FindObjectOfType <CibotAcademy>();
    }
Example #26
0
 public override void InitializeAgent()
 {
     base.InitializeAgent();
     agentRb = GetComponent <Rigidbody>();
     Monitor.verticalOffset = 1f;
     myArea       = area.GetComponent <BananaArea>();
     rayPer       = GetComponent <RayPerception3D>();
     myAcademy    = FindObjectOfType <BananaAcademy>();
     rooms        = FindObjectsOfType <Room>();
     index_double = UnityEngine.Random.Range(0, rooms.Length);
     index        = (int)Math.Round(index_double);
     room         = rooms[index];
     loc          = room.transform.position;
     size         = room.Size;
 }
 public override void InitializeAgent()
 {
     Invoke("PunishForNotMoving", 0.5f);
     oldPos = transform.position;
     base.InitializeAgent();
     ship     = GetComponent <SpaceShooter_Player>();
     team     = ship.team;
     rayPer   = GetComponent <RayPerception3D>();
     position = transform.position;
     SpaceShooter_Player[] players = FindObjectsOfType <SpaceShooter_Player>();
     foreach (SpaceShooter_Player player in players)
     {
         if (player.team == team)
         {
             Physics2D.IgnoreCollision(GetComponent <PolygonCollider2D>(), player.GetComponent <PolygonCollider2D>());
         }
     }
 }
 private void Start()
 {
     forestArea    = GetComponentInParent <ForestArea>();
     animator      = GetComponent <Animation>();
     rayPerception = GetComponent <RayPerception3D>();
     animalSound   = forestArea.animalSound;
     dogSound      = forestArea.dogSound;
     rb            = GetComponent <Rigidbody>();
     safeZone      = forestArea.safeZone;
     safeZone.GetComponent <Animation>().CrossFade("idle");
     saved_id     = 0;
     PbC.BarValue = 0;
     SadKoala.SetActive(true);
     HappyKoala.SetActive(false);
     lastWallCollision = 0.0f;
     lastSaved         = System.DateTime.Now.Second;
     Rabbit.SetActive(false);
     Squirrel.SetActive(false);
 }
Example #29
0
        public override void InitializeAgent()
        {
            base.InitializeAgent();
            _tank  = gameObject.GetComponent <TankController>();
            _input = GetComponent <TankInputs>();
//            _input.playerControl = false;

            _rayDistance = _tank.tooCloseLimit * 2;
            _enemy       = gs.GetEnemy(_tank);
            _enemyAgent  = _enemy.GetComponent <TankAgent>();


            _rayPerception = GetComponent <RayPerception3D>();
            _collectReward = true;


            TankAcademy academy = FindObjectOfType <TankAcademy>();

            _resetParameters = academy.resetParameters;
        }
Example #30
0
    // Start is called before the first frame update
    public override void InitializeAgent()
    {
        base.InitializeAgent();
        agentRb        = GetComponent <Rigidbody>();
        rayPer         = GetComponent <RayPerception3D>();
        HealthAgent    = GetComponent <HealthAgent>();
        EnergyAgent    = GetComponent <EnergyAgent>();
        RaycastShooter = GetComponent <RaycastShooter>();

        PlayerHealthAgent = Player.GetComponent <HealthAgent>();

        FloatVariable health = ScriptableObject.CreateInstance <FloatVariable>();

        health.InitialValue = InitialHealth;
        health.RuntimeValue = InitialHealth;
        HealthAgent.Health  = health;

        FloatVariable energy = ScriptableObject.CreateInstance <FloatVariable>();

        energy.InitialValue    = InitialEnergy;
        energy.RuntimeValue    = InitialEnergy;
        EnergyAgent.EnergyPool = energy;
    }