/// <summary> /// 機体構造の設定 /// </summary> public void SetStructure(ShipStructure structure) { weapon = structure.WeaponController; if (weapon) { weapon.SetBulletExclusionTag("Player"); } thruster = structure.ThrusterController; attitude = structure.AttitudeController; marker = structure.Marker; if (marker) { detector = marker.ObjDetector; detector.OnDetect.RemoveListener(OnDetect); detector.OnDetect.AddListener(OnDetect); detector.OnRelease.RemoveListener(OnRelease); detector.OnRelease.AddListener(OnRelease); } attackable = structure.Attackable; if (attackable) { attackable.OnAttacked.RemoveListener(OnAttacked); attackable.OnAttacked.AddListener(OnAttacked); attackable.OnDied.RemoveListener(OnDied); attackable.OnDied.AddListener(OnDied); } }
// Function that spawns a marker when a ship is activated (in start) and assigns its info. public void SpawnMarker() { if (markerPrefab != null) { // For now, spawn a marker at center. linkedMarker = Instantiate(markerPrefab).GetComponentInChildren <ShipMarker>(); linkedMarker.InitializeMarker(this, spawnMarkerOnShipPosition); } }
private void Awake() { _animator = GetComponent <Animator>(); _shipMarker = GetComponentInChildren <ShipMarker>(); }