// Use this for initialization void Start() { perception2D = GetComponent <RayPerception2D>(); angles = new float[] { 60, 45, 30, 0, 330, 315, 300 }; lines = GetComponent <LineRenderer>(); lines.positionCount = angles.Length * 2; }
public override void InitializeAgent() { perception = GetComponent <RayPerception2D>(); rb2D = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); startPos = transform.position; angles = new float[] { 60, 45, 30, 0, 330, 315, 300 }; detectableObjects = new string[] { "ground", "sky", "wall", "goal" }; }
public override void InitializeAgent() { oldPos = transform.position; Invoke("PunishForNotMoving", 0.5f); base.InitializeAgent(); player = GetComponent <FencingMates_Player>(); team = player.team; rayPer = GetComponent <RayPerception2D>(); position = transform.position; FencingMates_Player[] players = FindObjectsOfType <FencingMates_Player>(); }
public void TestPerception2D() { var angles = new[] { 0f, 90f, 180f }; var tags = new[] { "test", "test_1" }; var go = new GameObject("MyGameObject"); RayPerception2D rayPer2D = go.AddComponent <RayPerception2D>(); var result = rayPer2D.Perceive(1f, angles, tags); Debug.Log(result.Count); Assert.IsTrue(result.Count == angles.Length * (tags.Length + 2)); }
public override void InitializeAgent() { Invoke("PunishForNotMoving", 0.5f); oldPos = transform.position; base.InitializeAgent(); ship = GetComponent <SpaceShooter_Player>(); team = ship.team; rayPer = GetComponent <RayPerception2D>(); 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>()); } } }
// Essentially Start() public override void InitializeAgent() { base.InitializeAgent(); con = GetComponent <PlayerController>(); GameObject studentObj = GameManager.Instance.AssignBrain(); if (gameObject.tag == "Player") { studentObj = GameObject.Find("TeacherBrain"); } if (studentObj != null) { studentBrain = studentObj.GetComponent <Brain>(); GiveBrain(studentBrain); } else { throw new UnityAgentsException("Ryan: Can't find initial brain object!"); } rayComponent = GetComponent <RayPerception2D>(); }
private void Start() { gameArea = GetComponentInParent <gameArea>(); rayPerception = GetComponent <RayPerception2D>(); }
// Start is called before the first frame update void Start() { startPosition = transform.position; rigidbody = GetComponent <Rigidbody2D>(); rayPerception = GetComponent <RayPerception2D>(); }