public CoverPoint ToCoverPoint(CoverPointVolume volume) { this.Volume = volume; if (this.IsDynamic) { CoverPoint coverPoint = new CoverPoint(this.Volume, this.Score); coverPoint.IsDynamic = true; coverPoint.SourceTransform = ((Component)this).get_transform(); coverPoint.NormalCoverType = this.NormalCoverType; Transform transform = ((Component)this).get_transform(); coverPoint.Position = transform != null?transform.get_position() : Vector3.get_zero(); return(coverPoint); } Vector3 vector3 = Quaternion.op_Multiply(((Component)this).get_transform().get_rotation(), this.Normal); Vector3 normalized = ((Vector3) ref vector3).get_normalized(); return(new CoverPoint(this.Volume, this.Score) { IsDynamic = false, Position = ((Component)this).get_transform().get_position(), Normal = normalized, NormalCoverType = this.NormalCoverType }); }
public CoverPoint ToCoverPoint(CoverPointVolume volume) { Vector3 vector3; this.Volume = volume; if (!this.IsDynamic) { Vector3 normal = (base.transform.rotation * this.Normal).normalized; return(new CoverPoint(this.Volume, this.Score) { IsDynamic = false, Position = base.transform.position, Normal = normal, NormalCoverType = this.NormalCoverType }); } CoverPoint coverPoint = new CoverPoint(this.Volume, this.Score) { IsDynamic = true, SourceTransform = base.transform, NormalCoverType = this.NormalCoverType }; Transform transforms = base.transform; if (transforms != null) { vector3 = transforms.position; } else { vector3 = Vector3.zero; } coverPoint.Position = vector3; return(coverPoint); }
private void Awake() { if (base.transform.parent != null) { this.Volume = base.transform.parent.GetComponent <CoverPointVolume>(); } }
private void Awake() { if (!Object.op_Inequality((Object)((Component)this).get_transform().get_parent(), (Object)null)) { return; } this.Volume = (CoverPointVolume)((Component)((Component)this).get_transform().get_parent()).GetComponent <CoverPointVolume>(); }
public static CoverPointVolume CreateNewCoverVolume( Vector3 point, Transform coverPointGroup) { if (!Object.op_Inequality((Object)SingletonComponent <AiManager> .Instance, (Object)null) || !((Behaviour)SingletonComponent <AiManager> .Instance).get_enabled() || !((AiManager)SingletonComponent <AiManager> .Instance).UseCover) { return((CoverPointVolume)null); } CoverPointVolume coverPointVolume = ((AiManager)SingletonComponent <AiManager> .Instance).GetCoverVolumeContaining(point); if (Object.op_Equality((Object)coverPointVolume, (Object)null)) { Vector2i gridCoords = ((AiManager)SingletonComponent <AiManager> .Instance).coverPointVolumeGrid.WorldToGridCoords(point); coverPointVolume = !Object.op_Inequality((Object)((AiManager)SingletonComponent <AiManager> .Instance).cpvPrefab, (Object)null) ? (CoverPointVolume) new GameObject("CoverPointVolume").AddComponent <CoverPointVolume>() : (CoverPointVolume)Object.Instantiate <CoverPointVolume>((M0)((AiManager)SingletonComponent <AiManager> .Instance).cpvPrefab); ((Component)coverPointVolume).get_transform().set_localPosition((Vector3)null); ((Component)coverPointVolume).get_transform().set_position(Vector3.op_Addition(((AiManager)SingletonComponent <AiManager> .Instance).coverPointVolumeGrid.GridToWorldCoords(gridCoords), Vector3.op_Multiply(Vector3.get_up(), (float)point.y))); ((Component)coverPointVolume).get_transform().set_localScale(new Vector3(((AiManager)SingletonComponent <AiManager> .Instance).CoverPointVolumeCellSize, ((AiManager)SingletonComponent <AiManager> .Instance).CoverPointVolumeCellHeight, ((AiManager)SingletonComponent <AiManager> .Instance).CoverPointVolumeCellSize)); coverPointVolume.CoverLayerMask = ((AiManager)SingletonComponent <AiManager> .Instance).DynamicCoverPointVolumeLayerMask; coverPointVolume.CoverPointRayLength = ((AiManager)SingletonComponent <AiManager> .Instance).CoverPointRayLength; ((AiManager)SingletonComponent <AiManager> .Instance).coverPointVolumeGrid.set_Item(gridCoords, coverPointVolume); coverPointVolume.GenerateCoverPoints(coverPointGroup); } return(coverPointVolume); }
public static CoverPointVolume CreateNewCoverVolume(Vector3 point, Transform coverPointGroup) { if (!(SingletonComponent <AiManager> .Instance != null) || !SingletonComponent <AiManager> .Instance.enabled || !SingletonComponent <AiManager> .Instance.UseCover) { return(null); } CoverPointVolume coverVolumeContaining = SingletonComponent <AiManager> .Instance.GetCoverVolumeContaining(point); if (coverVolumeContaining == null) { Vector2i gridCoords = SingletonComponent <AiManager> .Instance.coverPointVolumeGrid.WorldToGridCoords(point); coverVolumeContaining = (SingletonComponent <AiManager> .Instance.cpvPrefab == null ? (new GameObject("CoverPointVolume")).AddComponent <CoverPointVolume>() : UnityEngine.Object.Instantiate <CoverPointVolume>(SingletonComponent <AiManager> .Instance.cpvPrefab)); coverVolumeContaining.transform.localPosition = new Vector3(); coverVolumeContaining.transform.position = SingletonComponent <AiManager> .Instance.coverPointVolumeGrid.GridToWorldCoords(gridCoords) + (Vector3.up * point.y); coverVolumeContaining.transform.localScale = new Vector3(SingletonComponent <AiManager> .Instance.CoverPointVolumeCellSize, SingletonComponent <AiManager> .Instance.CoverPointVolumeCellHeight, SingletonComponent <AiManager> .Instance.CoverPointVolumeCellSize); coverVolumeContaining.CoverLayerMask = SingletonComponent <AiManager> .Instance.DynamicCoverPointVolumeLayerMask; coverVolumeContaining.CoverPointRayLength = SingletonComponent <AiManager> .Instance.CoverPointRayLength; SingletonComponent <AiManager> .Instance.coverPointVolumeGrid[gridCoords] = coverVolumeContaining; coverVolumeContaining.GenerateCoverPoints(coverPointGroup); } return(coverVolumeContaining); }
public CoverPoint(CoverPointVolume volume, float score) { this.Volume = volume; this.Score = score; }