public override void OnSimulateStart() { this.transform.Find("Vis/Vis").GetComponent <MeshRenderer>().material.shader = Shader.Find("Legacy Shaders/Reflective/Bumped Specular"); this.transform.Find("Vis/Vis").GetComponent <MeshRenderer>().material.SetTexture("_BumpMap", ModResource.GetTexture("zDroneBump.png")); if (DroneAIType.Value == 1) { IAmSwitching = true; TargetSelector(); } else { foreach (DroneControlBlockBehavior DCBB in Machine.SimulationMachine.GetComponentsInChildren <DroneControlBlockBehavior>()) { if (DCBB.DroneTag.Value == this.DroneTag.Value) { DCBB.AIDroneList.Add(this); MyControl = DCBB; OrbitVeloMultiplier = 1f; 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.Rigidbody = this.Rigidbody; Destroy(Shooter.GetComponent <Rigidbody>()); ((List <MSlider>)(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>()); }
public override void SimulateUpdateAlways() { 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.SimulationMachine.GetComponentsInChildren <DroneControlBlockBehavior>()) { if (DCBB.DroneTag.Value == this.DroneTag.Value) { DCBB.AIDroneList.Add(this); MyControl = DCBB; break; } } } }