void Awake() { feeding = false; foodSource = GameObject.FindWithTag("Foodsource"); _testMovement = gameObject.GetComponent<TestMovement>(); //Increase the agent's hunger level every 5 seconds }
public void Respawn() { // Reset gravity cubes on respawn GravityCubeController[] gravityCubes = FindObjectsOfType(typeof(GravityCubeController)) as GravityCubeController[]; foreach (GravityCubeController gc in gravityCubes) { gc.ResetTrigger(); } // Respawn with max health??? health = maxHealth; healthBar.setValue(health); respawning = true; player.SetActive(false); //yield return new WaitForSeconds(1); player.transform.position = spawnpoint; player.transform.up = up; GravityController playerGravityController = this.GetComponent <GravityController>(); playerGravityController.SetGravity(-up); // lose coins TestMovement tm = player.GetComponent <TestMovement>(); tm.decreaseScore(); player.SetActive(true); anim.SetBool("Ss", true); respawning = false; }
void Awake() { feeding = false; foodSource = GameObject.FindWithTag("Foodsource"); _testMovement = gameObject.GetComponent <TestMovement>(); //Increase the agent's hunger level every 5 seconds }
// Alignment: Get the avereage velocity Vector2 computeAlignment(Transform myAgent) { Vector2 result = Vector3.zero; int neighbourCount = 0; foreach (Transform otherT in ListOfAgent) { if (otherT != myAgent) { if (Vector2.Distance(myAgent.position, otherT.position) < DETECT_RANGE) { TestMovement enemy = otherT.GetComponent <TestMovement>(); result += enemy.velocity; neighbourCount++; } } } if (neighbourCount == 0) { return(result); } result /= neighbourCount; result.Normalize(); return(result); }
private void Start() { _testMovement = GetComponent <TestMovement>(); _movement = _testMovement.MovementState; _conditions = _testMovement.ConditionState; _movement.ChangeState(CharacterStates.MovementStates.Running); }
private void Start() { tm = TestMovement.instance; direction = Random.Range(-1, 1); if (direction == 0) { direction = -1; } }
public void NewReference(Transform newTransfrom, TestMovement newTM, PlayerStats newPS, AnimatorController newAC, GameObject newlast, AudioSourceSetter newASS) { characterTransform = newTransfrom; TM = newTM; PS = newPS; AC = newAC; gameObj = newlast; if (newASS != null) { ASS = newASS; } }
void Awake() { startTime = Time.deltaTime; _testMovement = Agent.GetComponent<TestMovement>(); state = State.Wander; //agentArr = new GameObject[spawnCounter]; agentList = new List<GameObject>(); hungerValList = new List<int>(); //Uncomment to enable hunger actions //InvokeRepeating("AgentHunger", 1, 1); //StartCoroutine(FSM()); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player" && isOpen == true) { collision.transform.position = new Vector2(findPosition.X, findPosition.Y); TestMovement t = collision.gameObject.GetComponent <TestMovement>(); parent = exitPoint.transform.parent.gameObject; collision.transform.parent = parent.transform; parent.transform.TransformPoint(Vector3.zero); GameObject middle = parent.transform.Find("Mid").gameObject; GameObject camera = GameObject.Find("Main Camera"); Camera_script s = camera.GetComponent <Camera_script>(); s.target = new Vector3(middle.transform.position.x, middle.transform.position.y, -10); StartCoroutine(camera.GetComponent <Camera_script>().Transition()); t.passing(); } }
void FixedUpdate() { if (Input.GetKeyDown(KeyCode.E) && active && player.transform.parent.name == roomName && E.activeSelf && timer < 0) { TestMovement t = player.gameObject.GetComponent <TestMovement>(); player.transform.position = new Vector2(findPosition.X, findPosition.Y); parent = exitPoint.transform.parent.gameObject; player.transform.parent = parent.transform; parent.transform.TransformPoint(Vector3.zero); GameObject middle = parent.transform.Find("Mid").gameObject; GameObject camera = GameObject.Find("Main Camera"); Camera_script s = camera.GetComponent <Camera_script>(); //s.target = parent.transform; s.target = new Vector3(middle.transform.position.x, middle.transform.position.y, -10); //camera.target = parent; StartCoroutine(camera.GetComponent <Camera_script>().Transition()); t.passing(); } }
//public VisualEffect explosion; private void Awake() { player = GameObject.FindGameObjectWithTag("Player").GetComponent <TestMovement>(); audioSource = GameObject.FindGameObjectWithTag("Music").GetComponent <AudioManager>(); }
void Start() { player = GameObject.FindGameObjectWithTag("Player"); movement = GameObject.FindGameObjectWithTag("Feet").GetComponent <TestMovement>(); }
void Start() { _testMovement = GetComponent<TestMovement>(); }
private void Awake() { instance = this; }
void Start() { anim = GetComponent <Animator>(); playerMovement = GetComponent <TestMovement>(); rb2d = GetComponent <Rigidbody2D>(); }
// Use this for initialization void Start() { gravityGun = GameObject.FindGameObjectWithTag("Player").GetComponent <GravityGun>(); movement = GameObject.FindGameObjectWithTag("Feet").GetComponent <TestMovement>(); rotateGun = GameObject.FindGameObjectWithTag("Gun").GetComponent <RotateGun>(); }