void ShootArrow() { GameObject newArrow = Instantiate(arrowPrefab, transform.position, Quaternion.identity) as GameObject; ArrowScript arrScript = newArrow.GetComponent <ArrowScript>(); arrScript.isFriendly = true; Vector3 dir = Vector3.zero; switch (faceDirection) { case 1: dir = new Vector3(0, 1, 0); break; case 2: dir = new Vector3(1, 0, 0); break; case 3: dir = new Vector3(0, -1, 0); break; case 4: dir = new Vector3(-1, 0, 0); break; default: break; } newArrow.transform.position += dir; arrScript.SetDir(dir); }