public void FireLaser() { Vector3 offset = Vector3.zero; switch (m_startDir) { case Direction.UP: offset = new Vector3(0, +5, 0); break; case Direction.Right: offset = new Vector3(5, 0, 0); break; case Direction.Down: offset = new Vector3(0, -5, 0); break; case Direction.Left: offset = new Vector3(-5, 0, 0); break; } ILaser laser = Instantiate((Laser.Laser)m_laser, transform.position + offset, Quaternion.identity); laser.DestroyEvent += LaserDestoryEvent; laser.SetCurrentLaserDir(m_startDir); }
private void OnTriggerEnter2D(Collider2D col) { ILaser laser = col.gameObject.GetComponent <ILaser>(); if (laser != null) { Direction cuDir = laser.GetCurrentDir(); Direction nextDir = ChangeLaserDir(cuDir); laser.SetCurrentLaserDir(nextDir); col.gameObject.transform.position = transform.position; AddReflectDamage(1); float angle = EffectAngle(cuDir, nextDir); EffectManager.Instance.CallEffect(col.transform.position, angle, 0); } }