public void Play(DMKController controller) { parentController = controller; currentFrame = 0; if (bulletContainer != null && DMKSettings.instance.bulletStorePolicy == DMKBulletStorePolicy.ByController) { DestroyImmediate(bulletContainer); } bulletContainer = DMKSettings.instance.GetBulletContainer(this.parentController); foreach (DMKBulletShooterController shooterController in shooters) { shooterController.parentController = parentController; shooterController.bulletContainer = bulletContainer; DMKSubBulletShooterController subController = shooterController.subController; while (subController != null) { subController.internalController.parentController = parentController; subController.internalController.bulletContainer = bulletContainer; subController = subController.internalController.subController; } } foreach (DMKShooterModifier modifier in modifiers) { modifier.DMKInit(); } foreach (DMKTrigger trigger in triggers) { trigger.DMKInit(); } this.UpdateShooters(); }
public void RemoveModifier(DMKShooterModifier modifier) { this.modifiers.Remove(modifier); foreach (DMKShooterModifier m in this.modifiers) { if (m.next == modifier) { m.next = null; } } foreach (DMKBulletShooterController shooterController in this.shooters) { if (shooterController.shooter.modifier == modifier) { shooterController.shooter.modifier = null; } DMKSubBulletShooterController subController = shooterController.subController; if (subController != null) { while (subController != null) { if (subController.internalController.shooter.modifier == modifier) { subController.internalController.shooter.modifier = null; } subController = subController.internalController.subController; } } } }
void OnShooterMenuAddSubShooterClicked(object userData) { DMKBulletShooterController shooterController = (DMKBulletShooterController)ScriptableObject.CreateInstance <DMKBulletShooterController>(); shooterController.shooter = ScriptableObject.CreateInstance(userData as Type) as DMKBulletShooter; DMKBulletShooterController selectedController = (selectedGraphObject as DMKBulletShooterController); shooterController.editorExpanded = true; shooterController.parentController = selectedController.parentController; shooterController.gameObject = null; shooterController.bulletContainer = selectedController.bulletContainer; shooterController.overallLength = 30; shooterController.gameObject = selectedController.gameObject; shooterController.followParentDirection = true; DMKSubBulletShooterController subController = (DMKSubBulletShooterController)ScriptableObject.CreateInstance <DMKSubBulletShooterController>(); subController.internalController = shooterController; selectedController.subController = subController; EditorUtility.SetDirty(this.selectedController.gameObject); }
public BulletInfo(DMKSubBulletShooterController p, DMKBullet b) { currentCooldown = currentInterval = prevFrame = currentFrame = 0; this.parent = p; this.bulletRef = new WeakReference(b); }
float DrawSubControllerNode(DMKSubBulletShooterController controller, Rect windowRect, bool isSecondaryLevel = false) { if (controller.internalController == null) { return(windowRect.y + windowRect.height); } Rect nodeWindowRect; if (isSecondaryLevel) { nodeWindowRect = new Rect(windowRect.x, windowRect.y + 40 + ShooterNodeWindowHeight, windowRect.width, windowRect.height); } else { nodeWindowRect = new Rect(windowRect.x + 5, windowRect.y + 40 + ShooterNodeWindowHeight, windowRect.width - 10, windowRect.height - 10); } this.DrawVerticalBezier(new Vector3(windowRect.x + windowRect.width / 2, windowRect.y + windowRect.height), new Vector3(nodeWindowRect.x + nodeWindowRect.width / 2, nodeWindowRect.y), true); GUIStyle shooterStyle = (GUIStyle)"flow node 0"; if (selectedGraphObject == controller.internalController) { shooterStyle = (GUIStyle)"flow node 0 on"; } GUILayout.BeginArea(nodeWindowRect, shooterStyle); this.OnShooterWindow(controller.internalController, nodeWindowRect, true); GUILayout.EndArea(); controller.editorWindowRect = controller.internalController.editorWindowRect = nodeWindowRect; if (controller.internalController.shooter.modifier != null) { DMKShooterModifier modifier = controller.internalController.shooter.modifier; this.DrawVerticalBezier(new Vector3(nodeWindowRect.x + nodeWindowRect.width / 2, nodeWindowRect.y + nodeWindowRect.height), new Vector3(modifier.editorWindowRect.x + modifier.editorWindowRect.width / 2, modifier.editorWindowRect.y), true); } DMKSubBulletShooterController next = controller.internalController.subController; while (next != null) { nodeWindowRect.y = this.DrawSubControllerNode(next, nodeWindowRect, true); next = next.internalController.subController; } return(nodeWindowRect.y); }