private void CheckMatch() { if (currentBug.bugColor == targetColor) { BugUtils.PaintBugOccur(); readyToPaint = false; LinearMove movementCtrl = currentBug.gameObject.AddComponent <LinearMove>(); movementCtrl.Init(true, 5); } }
IEnumerator SpawnBug(BugData data) { yield return(new WaitForSeconds(data.spawnTime)); if (!data.flying) { Transform spawnLocation = data.fromLeft ? leftGroundSpawn : rightGroundSpawn; GameObject bug = Instantiate(groundBugPrefab, spawnLocation.position, Quaternion.identity); Bug bugCtrl = bug.GetComponent <Bug>(); bugCtrl.Init(data); LinearMove movementCtrl = bug.GetComponent <LinearMove>(); movementCtrl.Init(data.fromLeft, data.speed); } else { Transform spawnLocation = data.fromLeft ? leftAirSpawn : rightAirSpawn; GameObject bug = Instantiate(airBugPrefab, spawnLocation.position, Quaternion.identity); Bug bugCtrl = bug.GetComponent <Bug>(); bugCtrl.Init(data); SineMove movementCtrl = bug.GetComponent <SineMove>(); movementCtrl.Init(data.fromLeft, data.speed, spawnLocation.position.y, -1, -1); } }
// Start is called before the first frame update void Start() { health.setHP(300); move = new LinearMove(); damage = 100; }
private void Awake() { _cameraMove = GetComponent <LinearMove>(); _transform = transform; }
// Initializing private void Start() { _thisCollider = GetComponent <BoxCollider2D>(); _thisMove = GetComponent <LinearMove>(); _thisAnimator = GetComponent <Animator>(); }