//public GameObject thisEnemy; //private weaponScript[] weapons; void Awake() { // Retrieve the weapon only once //weapons = GetComponentsInChildren<weaponScript>(); // Retrieve scripts to disable when not spawn MoveScript = GetComponent<moveScript>(); rabbitMoveScript = GetComponent<rabbitMove> (); }
// Start is called before the first frame update void Start() { playerMovement = player.GetComponent <moveScript>(); expectedPos = new Vector3(player.transform.position.x, player.transform.position.y, -10); transform.position = expectedPos; rb2d = GetComponent <Rigidbody2D>(); playerPos = playerMovement.currentPos; }
void Start() { player = FindObjectOfType <moveScript>(); if (player.transform.position.x < transform.position.x) { maxSpeed = -maxSpeed; } }
void Start() { correctLayer = gameObject.layer; spriteRend = GetComponent <SpriteRenderer>(); move = GetComponent <moveScript>(); if (spriteRend == null) { Debug.LogError("Object '" + gameObject.name + "' has no sprite renderer."); } }
// Start is called before the first frame update void Start() { playerMovement = player.GetComponent <moveScript>(); playerPos = playerMovement.currentPos; transform.position = playerPos; }
// Start is called before the first frame update void Start() { playerMovement = player.GetComponent <moveScript>(); transform.position = new Vector3(player.transform.position.x, player.transform.position.y, -10); rb2d = GetComponent <Rigidbody2D>(); }