public override void Attack(StateController controller, AttackScript attackScript) { if (!(controller is SStateController)) { Debug.LogError("Wrong controller user!"); return; } Vector2 playerPos = controller.sPlayer.position; var shotTransform = Instantiate(attackScript.projectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); shotTransform.position = controller.thisTransform.position; MouseInformation info = new MouseInformation(); info.position1 = controller.thisTransform.position; info.setPosition2(controller.sPlayer.position); if (setRotation) { shotTransform.localRotation = Quaternion.AngleAxis(info.rotationInternal, Vector3.forward); } projectile.isEnemy = true; projectile.multiHit = attackScript.multihit; projectile.lifeTime = attackScript.lifeTime; projectile.SetDamage(attackScript.damage, 0, 1); projectile.SetMovement(attackScript.speed, info.rotationInternal); attackScript.bgui.effectList.Add(projectile); }
void Start() { dropdown.onValueChanged.AddListener(delegate { DropdownValueChanged(dropdown); }); button.onClick.AddListener(TaskOnClick); if (ShowSymptome) { data = MouseInformation.Symptomes; } else { data = MouseInformation.Transmition; } foreach (string s in data) { dataReadable.Add(MouseInformation.ToReadableString(s)); } dropdown.ClearOptions(); dropdown.AddOptions(dataReadable); }
public override bool Use(KanjiValues values, int attackValue, MouseInformation info) { var shotTransform = Instantiate(values.projectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); if (placeInMiddle) { Vector3 pos = new Vector3(info.position1.x + info.distX * 0.5f, info.position1.y + info.distY * 0.5f, 0); shotTransform.position = pos; } else { shotTransform.position = info.position2; } if (setRotation) { float rotation = info.rotationInternal * 180 / Mathf.PI; shotTransform.localRotation = Quaternion.AngleAxis(rotation, Vector3.forward); } projectile.lifeTime = values.projectileLifetime; projectile.multiHit = values.multihit; projectile.SetDamage(values.damage, attackValue, values.baseDamageScale); projectile.SetMovement(values.projectileSpeed, info.rotationInternal); MainControllerScript.instance.battleGUI.effectList.Add(projectile); return(true); }
protected override bool Process(MouseButton button, MouseButtonState state, MouseInformation info) { var inActivationArea = 0 < info.X && info.X < SystemParameters.PrimaryScreenWidth * 0.1; if (button == MouseButton.Left) { if (state == MouseButtonState.Released) { isDown = false; } if (state == MouseButtonState.Pressed && inActivationArea) { isDown = true; Task.Delay(ACTIVATION_INTERVAL).ContinueWith(async _ => { for (var t = 0; t < 4; t++) { if (WasActivated()) { break; } await Task.Delay(ACTIVATION_INTERVAL); } }); } } return(false); }
/// <summary> /// Creates the effect of the kanji. /// </summary> /// <param name="info"></param> /// <param name="attackValue"></param> public void CreateEffects(MouseInformation info, int attackValue) { for (int i = 0; i < effects.Count; i++) { effects[i].Use(values, attackValue, info); } }
private bool MouseHookCallback(MouseButton button, MouseButtonState state, MouseInformation info) { if (!paused && info.IsTouch) { return(Process(button, state, info)); } return(false); }
private MouseInformation GetInfo(MSLLHOOKSTRUCT mouseData) { var info = new MouseInformation(); var extraInfo = mouseData.DwExtraInfo.ToUInt32(); info.IsTouch = (extraInfo & Constant.MOUSEEVENTF_MASK) == Constant.MOUSEEVENTF_FROMTOUCH; info.X = mouseData.Point.X; info.Y = mouseData.Point.Y; return(info); }
public override void Attack(StateController controller, AttackScript attackScript) { if (!(controller is AStateController)) { Debug.LogError("Wrong controller user!"); return; } var shotTransform = Instantiate(attackScript.projectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); if (targeting) { shotTransform.position = controller.aPlayer.position; } else { shotTransform.position = controller.thisTransform.position; } MouseInformation info = new MouseInformation(); info.position1 = controller.thisTransform.position; info.setPosition2(controller.aPlayer.position); if (setRotation) { float rotation = info.rotationInternal * 180 / Mathf.PI; shotTransform.localRotation = Quaternion.AngleAxis(rotation, Vector3.forward); } projectile.isEnemy = true; projectile.multiHit = attackScript.multihit; projectile.SetDamage(attackScript.damage, 0, 1); projectile.impactSound = controller.values.attackImpactSfx; projectile.SetMovement(attackScript.speed, info.rotationInternal); attackScript.bgui.effectList.Add(projectile); if (controller.values.attackActivateSfx != null) { controller.currentSfx.value.Enqueue(controller.values.attackActivateSfx.clip); controller.playSfxEvent.Invoke(); } float startPoint = Random.Range(0, 2 * Mathf.PI); for (int i = 0; i < circleProjectiles; i++) { Projectile circleProj = Instantiate(projectile); Vector3 offset = circleOffset * new Vector3(Mathf.Cos(startPoint), Mathf.Sin(startPoint), 0); circleProj.transform.position += offset; startPoint += 2 * Mathf.PI / circleProjectiles; attackScript.bgui.effectList.Add(circleProj); } }
/// <summary> /// Checks if all activation requirements are fullfilled. /// </summary> /// <param name="info"></param> /// <returns></returns> public bool CanActivate(MouseInformation info) { for (int i = 0; i < activations.Count; i++) { if (!activations[i].CanActivate(values, info)) { return(false); } } return(true); }
private bool MouseHookCallback(MouseButton button, MouseButtonState state, MouseInformation info) { var block = false; block |= button == MouseButton.Auxiliary; block |= button == MouseButton.Middle && !settings.AllowMiddleButton; block |= button == MouseButton.Right && !settings.AllowRightButton; if (block) { logger.Info($"Blocked {button.ToString().ToLower()} mouse button when {state.ToString().ToLower()}."); } return(block); }
public override void Attack(StateController controller, AttackScript attackScript) { if (!(controller is SStateController)) { Debug.LogError("Wrong controller user!"); return; } Vector2 playerPos = controller.sPlayer.position; var shotTransform = Instantiate(attackScript.projectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); shotTransform.position = controller.thisTransform.position; MouseInformation info = new MouseInformation(); info.position1 = controller.thisTransform.position; //Aim position if (targeting) { info.setPosition2(controller.sPlayer.position); } else { Vector2 aimPosition = new Vector2(Constants.SOLDIER_START_X, Constants.SOLDIER_START_Y); info.setPosition2(aimPosition); } if (setRotation) { shotTransform.localRotation = Quaternion.AngleAxis(info.rotationInternal, Vector3.forward); } projectile.isEnemy = true; projectile.multiHit = attackScript.multihit; projectile.SetDamage(attackScript.damage, 0, 1); projectile.impactSound = controller.values.attackImpactSfx; projectile.SetMovement(attackScript.speed, info.rotationInternal); attackScript.bgui.effectList.Add(projectile); if (controller.values.attackActivateSfx != null) { controller.currentSfx.value.Enqueue(controller.values.attackActivateSfx.clip); controller.playSfxEvent.Invoke(); } }
public bool CanActivate(MouseInformation info) { if (module == null) { return(false); } if (!active) { return(false); } if (currentCharge <= 0) { return(false); } return(module.CanActivate(info)); }
/// <summary> /// Checks each kanji equipped if they can be activated. /// </summary> /// <param name="mouseInfo"></param> /// <returns></returns> public bool Activate(MouseInformation mouseInfo) { if (shootCooldown > 0f) { return(false); } for (int i = 0; i < 4; i++) { if (kanji[i].CanActivate(mouseInfo)) { shootCooldown = kanji[i].GetValues().delay; kanji[i].reduceCharge(); kanji[i].CreateEffect(mouseInfo, playerAttack.value); return(true); } } return(false); }
public override bool CanActivate(Module values, MouseInformation info) { if (info.holding || info.holdDuration > values.holdMax) { return(false); } if (!info.clicked) { return(false); } float dist = info.GetInternalDistance(); if (dist > values.area) { return(false); } return(true); }
/// <summary> /// Checks each module equipped if they can be activated. /// </summary> /// <param name="mouseInfo"></param> /// <returns></returns> public bool Activate(MouseInformation mouseInfo) { if (shootCooldown > 0f) { return(false); } for (int i = 0; i < 4; i++) { if (containerModules[i].CanActivate(mouseInfo)) { shootCooldown = containerModules[i].module.delay; containerModules[i].reduceCharge(); containerModules[i].PlayActivationSfx(); containerModules[i].CreateEffect(mouseInfo, playerAttack.value); return(true); } } return(false); }
public override bool CanActivate(KanjiValues values, MouseInformation info) { if (info.holding || info.holdDuration > 0.5f) { return(false); } if (!info.clicked) { return(false); } float dist = info.GetInternalDistance(); if (dist < values.area) { return(false); } float lCone = Mathf.PI * lowAngle / 180.0f; float hCone = Mathf.PI * highAngle / 180.0f; if (lCone < info.rotationInternal && info.rotationInternal < hCone) { return(true); } if (bothDirections) { lCone = lCone - (Mathf.PI * Mathf.Sign(lCone)); hCone = hCone - (Mathf.PI * Mathf.Sign(hCone)); if (lCone < info.rotationInternal || info.rotationInternal < hCone) { return(true); } } return(false); }
public override void Attack(StateController controller, AttackScript attackScript) { if (!(controller is SStateController)) { Debug.LogError("Wrong controller user!"); return; } SStateController scon = (SStateController)controller; var shotTransform = Instantiate(attackScript.projectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); shotTransform.position = scon.thisTransform.position; MouseInformation info = new MouseInformation(); info.position1 = controller.thisTransform.position; info.setPosition2(controller.sPlayer.position); if (setRotation) { float rotation = info.rotationInternal * 180 / Mathf.PI; shotTransform.localRotation = Quaternion.AngleAxis(rotation, Vector3.forward); } projectile.isEnemy = true; projectile.multiHit = false; projectile.multiHit = attackScript.multihit; projectile.SetDamage(attackScript.damage, 0, 1); projectile.impactSound = controller.values.attackImpactSfx; projectile.SetMovement(attackScript.speed, info.rotationInternal); attackScript.bgui.effectList.Add(projectile); if (controller.values.attackActivateSfx != null) { controller.currentSfx.value.Enqueue(controller.values.attackActivateSfx.clip); controller.playSfxEvent.Invoke(); } }
// Use this for initialization void Start() { if (rigidbodyComponent == null) { rigidbodyComponent = GetComponent <Rigidbody2D>(); } if (coll2D == null) { coll2D = GetComponent <Collider2D>(); } if (moveToPosition == null) { moveToPosition = GetComponent <MoveHomingScript>(); } mouseInfo = new MouseInformation(); startX = transform.position.x; startY = transform.position.y; mouseInfo.playerPosition = transform.position; mouseInfo.holding = false; mouseInfo.holdDuration = -1; animInfo = new AnimationInformation(); }
public override bool Use(Module values, int attackValue, MouseInformation info) { var shotTransform = Instantiate(values.projectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); MainControllerScript.instance.battleGUI.effectList.Add(projectile); shotTransform.position = info.playerPosition; if (setRotation) { float rotation = info.rotationPlayer * 180 / Mathf.PI; shotTransform.localRotation = Quaternion.AngleAxis(rotation, Vector3.forward); } projectile.isEnemy = false; projectile.steps = values.effectSteps; projectile.multiHit = values.multihit; projectile.SetDamage(values.damage, attackValue, values.baseDamageScale); projectile.impactSound = values.impactSound; projectile.SetMovement(values.projectileSpeed, info.rotationPlayer); return(true); }
public override bool CanActivate(KanjiValues values, MouseInformation info) { if (info.holdDuration < values.holdMin || !info.holding) { return(false); } if (!continuous) { info.holdDuration = 0; } // float dist = info.GetInternalDistance(); // if (dist > area) { // if (running) { // running = false; // base.reduceCharge(1.0f); // info.holdDuration = 0; // } // return false; // } return(true); }
abstract public bool CanActivate(KanjiValues values, MouseInformation info);
/// <summary> /// Creates the effects and projectiles defined in the module itself. /// </summary> /// <param name="info"></param> /// <param name="attackValue"></param> public void CreateEffect(MouseInformation info, int attackValue) { module.CreateEffects(info, attackValue); }
/// <summary> /// Trigger the kanji effect. /// </summary> /// <param name="values"></param> /// <param name="info"></param> /// <returns></returns> abstract public bool Use(KanjiValues values, int attackValue, MouseInformation info);
protected abstract bool Process(MouseButton button, MouseButtonState state, MouseInformation info);
abstract public bool CanActivate(Module values, MouseInformation info);
/// <summary> /// Trigger the module effect. /// </summary> /// <param name="values"></param> /// <param name="info"></param> /// <returns></returns> abstract public bool Use(Module values, int attackValue, MouseInformation info);