// Update is called once per frame void Update() { player = FindObjectOfType <PlayerSolo>(); Vector3 diff = (player.transform.position - transform.position); mag = (player.transform.position - transform.position).magnitude; float angle = Mathf.Atan2(diff.y, diff.x); transform.rotation = Quaternion.Euler(0f, 0f, (angle * Mathf.Rad2Deg) - 89.5f); if (mag <= 10) { transform.RotateAround(player.transform.position, new Vector3(0, 0, 1), rad * 5 * Time.deltaTime); } if (attackSpeed % (60 + r) == 0 && mag < 80 && Time.deltaTime > 0) { Instantiate(bulletPrefab, cannon.transform.position, cannon.transform.rotation); r = Random.Range(0, 120); } attackSpeed++; }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); player = GetComponent <PlayerSolo>(); player.SetMultiplierMaxTime(200); fire = false; }
// Use this for initialization void Awake() { player = FindObjectOfType <PlayerSolo>(); animator = GetComponent <Animator>(); r = 0; speed = 0.2f; rad = Random.Range(-2, 2); }
private void SpawnPlayer() { playerSolo = FindObjectOfType <PlayerSolo>(); if (playerSolo == null) { GameObject spawn = Instantiate(spawnPrefab, new Vector3(Random.Range(-15, 15), Random.Range(-7, 9), 0), Quaternion.Euler(0, 0, 0)); playerSolo = Instantiate(playerPrefab, spawn.transform.position, Quaternion.Euler(0, 0, 0)).GetComponent <PlayerSolo>(); } }
// Use this for initialization void Awake() { rb = GetComponent <Rigidbody2D>(); bulletSpeed = 1500f; rb.AddRelativeForce(new Vector2(0, bulletSpeed)); player = FindObjectOfType <PlayerSolo>(); }
// Use this for initialization void Awake() { rb = GetComponent <Rigidbody2D>(); bulletSpeed = 700f; rb.AddRelativeForce(new Vector2(0, bulletSpeed)); player = FindObjectOfType <PlayerSolo>(); animator = FindObjectOfType <Animator>(); explode = false; }
// Use this for initialization void Start() { animator = GetComponent <Animator>(); player = GetComponent <PlayerSolo>(); player.SetMultiplierMaxTime(90); }
// Update is called once per frame void Update() { player = FindObjectOfType <PlayerSolo>(); transform.SetPositionAndRotation(new Vector3(player.transform.localPosition.x, player.transform.localPosition.y, -20), Quaternion.Euler(0, 0, 0)); }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerSolo>(); }