protected override void OnSimulateFixedStart() { if (DroneAIType.Value == 1) { IAmSwitching = true; TargetSelector(); } else { foreach (DroneControlBlockBehavior DCBB in Machine.Active().SimulationMachine.GetComponentsInChildren <DroneControlBlockBehavior>()) { if (DCBB.DroneTag.Value == this.DroneTag.Value) { DCBB.AIDroneList.Add(this); MyControl = DCBB; break; } } } Shooter = Instantiate(PrefabMaster.BlockPrefabs[11].gameObject); Shooter.transform.parent = this.transform; Destroy(Shooter.GetComponent <ConfigurableJoint>()); 炮弹速度 = 5 * 58; Shooter.transform.localEulerAngles = Vector3.right * 270; Shooter.transform.localPosition = Vector3.up * 0.8f + Vector3.forward * 3f; Destroy(Shooter.GetComponentInChildren <CapsuleCollider>()); CB = Shooter.GetComponent <CanonBlock>(); CB.knockbackSpeed = 30; CB.myRigidbody = rigidbody; Destroy(Shooter.GetComponent <Rigidbody>()); CB.Sliders[0].Value = 5; MeshCollider MC = this.transform.GetComponentInChildren <MeshCollider>(); MC.material.dynamicFriction = 0; MC.material.staticFriction = 0; MyPrecision = 0.25f; MySize = 1; 精度 = 0.25f; size = 1; SetUpHP(200); RotatingSpeed = 1f; //RotatingSpeed = 5f; PositionIndicator = GameObject.CreatePrimitive(PrimitiveType.Sphere); DestroyImmediate(PositionIndicator.GetComponent <Rigidbody>()); DestroyImmediate(PositionIndicator.GetComponent <Collider>()); }
protected override void OnSimulateUpdate() { if (Shooter != null) { Shooter.transform.localEulerAngles = Vector3.right * 270; Shooter.transform.localPosition = Vector3.up * 0.8f + Vector3.forward * 3f; } if (DroneAIType.Value == 0 && MyControl == null) { foreach (DroneControlBlockBehavior DCBB in Machine.Active().SimulationMachine.GetComponentsInChildren <DroneControlBlockBehavior>()) { if (DCBB.DroneTag.Value == this.DroneTag.Value) { DCBB.AIDroneList.Add(this); MyControl = DCBB; break; } } } }