// Update is called once per frame void Update() { float x = Input.GetAxisRaw("Horizontal"); float y = Input.GetAxisRaw("Vertical"); Vector2 direction = new Vector2(x, y).normalized; //GetComponent<Rigidbody2D>().velocity = direction * speed; spaceship.Move(direction); }
// Update is called once per frame void Update() { float x = Input.GetAxisRaw("Horizontal"); float y = Input.GetAxisRaw("Vertical"); Vector2 direction = new Vector2(x, y).normalized; spaceship.Move(direction); Clamp(); }
IEnumerator Start() { spaceship = GetComponent <CommonSpaceship>(); spaceship.Move(transform.up * -1); while (true) { for (int i = 0; i < transform.childCount; i++) { Transform shotPosition = transform.GetChild(i); spaceship.Shot(shotPosition); } yield return(new WaitForSeconds(spaceship.shotDelay)); } }