private void Start() { player = FindObjectOfType <PlayerInput>(); bossPattern = FindObjectOfType <AttackPattern>(); StartCoroutine(StartLevel()); }
public void ChooseWeapon() { if (unitObj == null) { Debug.LogWarning("Can't find unit object."); return; } if (info.NoMoreUses()) { return; } Component[] patterns = unitObj.GetComponents(Type.GetType(info.attackPattern.name)); foreach (Component c in patterns) { AttackPattern p = (AttackPattern)c; if (p.data.name.Equals(info.name)) { controller.attackPattern = p; break; } } if (controller.CurrentState.stateName.Equals("AttackTargetState")) { controller.GetComponent <AttackTargetState>().UpdateTiles(); } else { controller.ChangeState <AttackTargetState>(); } }
private void GetBestTiles(BoardCreator board, List <Tile> movementTiles) { moveTarget = null; int leastMoveDist = 100; int bestValue = 0; AttackPattern pattern = GetComponent <AttackPattern>(); foreach (Tile t in movementTiles) { List <List <Tile> > inRange = pattern.GetTilesInRange(board, t.pos); foreach (List <Tile> targets in inRange) { int value = GetTileGroupValue(targets); if (value >= bestValue) { if (value > bestValue || (GetMoveDist(t) < leastMoveDist)) { attackTarget = targets; bestValue = value; moveTarget = t; leastMoveDist = GetMoveDist(t); } } } } }
public virtual IEnumerator TakeTurn(BoardCreator board) { if (!CanMove()) { ResetMove(); } else { if (nonNullAttackTarget != null) { AttackPattern pattern = GetComponent <AttackPattern>(); yield return(StartCoroutine(pattern.Attack(nonNullAttackTarget))); pattern.SetData(GetComponent <UnitStats>().unitInfo.WeaponMain); yield return(StartCoroutine(pattern.HitUnits(board, attackTarget, moveTarget))); attackTarget = null; nonNullAttackTarget = null; } else { SetNextMove(board); Movement m = GetComponent <Movement>(); yield return(StartCoroutine(m.Traverse(moveTarget))); } } }
/// <summary> /// 他プレイヤーの情報取得 /// </summary> private void getOtherPlayerInfo() { // 自分から見て、他プレイヤーの情報を取得 switch (NAct.gameObject.name) { case "Player1": otherPlayerX = NAct.Nmng.Player[1].NVariable.X; otherPlayerZ = NAct.Nmng.Player[1].NVariable.Z; otherPlayerPunch = NAct.Nmng.Player[1].NVariable.st_punch; otherPlayerKick = NAct.Nmng.Player[1].NVariable.st_kick; otherPlayerAttack = NAct.Nmng.Player[1].NAttackV.NowAttack; otherHitBox = NAct.Nmng.Player[1].NAttackV.hitBox; otherPlayeAttackHit = NAct.Nmng.Player[1].NAttackV.MyAttackHit; break; case "Player2": otherPlayerX = NAct.Nmng.Player[0].NVariable.X; otherPlayerZ = NAct.Nmng.Player[0].NVariable.Z; otherPlayerPunch = NAct.Nmng.Player[0].NVariable.st_punch; otherPlayerKick = NAct.Nmng.Player[0].NVariable.st_kick; otherPlayerAttack = NAct.Nmng.Player[0].NAttackV.NowAttack; otherHitBox = NAct.Nmng.Player[0].NAttackV.hitBox; otherPlayeAttackHit = NAct.Nmng.Player[0].NAttackV.MyAttackHit; break; } }
public PlanOfAttack Evaluate() { PlanOfAttack poa = new PlanOfAttack(); AttackPattern pattern = actor.GetComponentInChildren <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { DefaultAttackPattern(poa); } if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { MoveTowardOpponent(poa); } return(poa); }
public override IEnumerator Activate(AttackPattern caller) { m_bossAI.GetAnimator.SetBool("Attack", true); m_bossAI.GetAnimator.SetFloat("AttackIndex", 2); m_attackPatternParent = caller; yield return(null); }
// Update is called once per frame void Update() { UIUpdate(); if (m_currentAttack != null && m_currentAttack.IsFinished) { m_currentAttack.EndAttack(); m_currentAttack = null; } if (!m_taunt && Player.Dead) { if (m_currentAttack != null) { CurrentAttackPattern.EndAttack(); } m_currentAttack = null; m_taunt = true; m_animator.SetBool("Taunt", true); } if (Player.Dead) { return; } if (m_currentAttack == null && m_EnemyStat.HP > 0) { m_attackTransitionTimer += Time.deltaTime; } if (m_attackTransitionTimer > m_AttackTransitionTime && m_attackPatterns.Count != 0 && m_currentAttack == null) { m_animator.SetBool("Taunt", false); m_currentAttack = m_attackPatterns[m_attackIndex]; StartCoroutine(m_currentAttack.Attack()); //Increment Attack index without going over the number of attack patterns detected. m_attackIndex = (m_attackIndex + 1) % m_attackPatterns.Count; m_attackTransitionTimer = 0; } if (m_health <= 0) { Die(); } if (!m_Invulnerable) { return; } InvulnerableFeedback(); if (InvulnerabilityOff()) { m_Invulnerable = false; m_invulnerabilityTimer = 0; GetComponent <SpriteRenderer>().color = Color.white; } }
public void Init(string name, string ownerID, string contrllerID, string UUID, int x, int y, int damage, int radius, bool triggered, AttackPattern pattern) { Init(name, ownerID, contrllerID, UUID, x, y, false); this.damage = damage; this.radius = radius; this.triggered = triggered; this.pattern = pattern; }
void RandomizeAttack() { //Randomizes the attack pattern from a list of attack patterns attackStarted = true; GetComponent <UnityArmatureComponent>().animation.Play("Attack", 1); AttackPattern attackPattern = attackPatterns[Random.Range(0, attackPatterns.Length)]; StartCoroutine(attackPattern.SequenceCoroutine(runner, AttackPatternCallBack)); }
public override IEnumerator Activate(AttackPattern caller) { m_descending = true; Activated = true; m_bossAI.GetAnimator.SetFloat("AttackIndex", -1); m_bossAI.GetRigidBody.AddForce(Vector2.down * DropSpeed); m_attackPatternParent = caller; yield return(null); }
private void ShowAttack() { AttackPattern pattern = owner.currentTile.content.GetComponent <AttackPattern>(); highlightedTiles = pattern.GetAllTilesInRange(owner.board); board.SelectTiles(highlightedTiles); battleUI.ShowPortrait(owner.currentTile.content.GetComponent <UnitStats>().playerUnitInfo); }
public override void Update() { base.Update(); if (GameManager.sSingleton.IsBossMakeEntrance()) { return; } if (delayBeforeAttack != 0) { mTimer += Time.deltaTime; if (mTimer < delayBeforeAttack) { return; } } if (currActionNum < attackTransList.Count) { // Handle movement. if (mEnemyMovement.enabled == true && currActionNum < mEnemyMovement.movementList.Count && !mEnemyMovement.movementList[currActionNum].isCoroutine) { mMovementCo = mEnemyMovement.MoveToWayPoint(currActionNum); StartCoroutine(mMovementCo); } List <AttackPattern> currAtkSequence = mFullAtkList[currActionNum]; for (int i = 0; i < currAtkSequence.Count; i++) { AttackPattern currAtkType = currAtkSequence[i]; if (i == 0) { currAtkType.StartAttack(UpdateAttack); } else { currAtkType.StartAttack(() => { }); } } float hpToMinus = currAtkSequence[0].hpPercentSkipAtk / 100 * totalHitPoint; float hpThresholdToSkip = totalHitPoint - hpToMinus; if (currHitPoint <= hpThresholdToSkip) { for (int i = 0; i < currAtkSequence.Count; i++) { currAtkSequence[i].StopCoroutine(); } UpdateAttack(); BulletManager.sSingleton.TransformEnemyBulsIntoScorePU(); // BulletManager.sSingleton.DisableEnemyBullets(false); } } }
public PlanOfAttack Evaluate() { string state; PlanOfAttack poa = new PlanOfAttack(); poa.complete = false; state = EvaluateState(); if (actor.lastState != state) { actor.lastState = state; if (state == "Default") { bc.GetComponentInChildren <BattleMessageController>().Display(actor.name + " feels normal"); } else if (state == "Shaken") { bc.GetComponentInChildren <BattleMessageController>().Display(actor.name + " feels shaken"); } else if (state == "Emboldened") { bc.GetComponentInChildren <BattleMessageController>().Display(actor.name + " feels emboldened"); } actor.transform.Find(state + " " + actor.GetComponentInChildren <Job>().name + " Attack Pattern").GetComponent <AttackPattern>().index = 0; } AttackPattern pattern = actor.transform.Find(state + " " + actor.GetComponentInChildren <Job>().name + " Attack Pattern").GetComponent <AttackPattern>(); if (pattern) { pattern.Pick(poa); } else { DefaultAttackPattern(poa); } if (poa.complete == false) { if (IsPositionIndependent(poa)) { PlanPositionIndependent(poa); } else if (IsDirectionIndependent(poa)) { PlanDirectionIndependent(poa); } else { PlanDirectionDependent(poa); } if (poa.ability == null) { MoveTowardOpponent(poa); } } return(poa); }
public Weapon(string name, string image, int attackModifier, int range, string description, List <TargetGridTile> attackTiles, bool rotatable, int numTargets) { this.Name = name; this.Image = image; this.Description = description; this.AttackModifier = attackModifier; NumTargets = numTargets; AttackRange = range; Pattern = MakeDamageMap(attackTiles, rotatable); }
private void CheckIfSubIsPastChargingArea() { if (Vector2.Distance(targetGameObject.transform.position, centerPosition) > distanceFromCenterPointCharging) { currentAttactPattern = AttackPattern.BasicChasing; } else if (Vector2.Distance(targetGameObject.transform.position, centerPosition) < distanceFromCenterPointCharging) { currentAttactPattern = AttackPattern.Charging; } }
public static void SetAttack(ItemData weapon, GameObject obj) { if (weapon == null) { return; } AttackPattern script = (AttackPattern)obj.AddComponent(Type.GetType(weapon.attackPattern.name)); script.SetData(weapon); }
//To be called upon unit death. public void Die() { if (m_currentAttack != null) { m_currentAttack.StopAttack(); } m_currentAttack = null; m_attackPatterns.Clear(); Destroy(gameObject); LevelEventHandler.TriggerEvent("Victory"); }
public override void Awake() { base.Awake(); healthBar = GameObject.Find("Boss HealthBar").GetComponent <HealthBar>(); healthBar.SetMaxHealt(baseHP); pattern = GetComponent <AttackPattern>(); player = GameObject.Find("Player").GetComponent <Transform>(); currentModel = gameObject.transform.GetChild(0).gameObject; }
/// <summary> /// Start this instance. /// </summary> void Start() { health = maxHealth; EnemyManager.RegisterEnemy(this); fmp = GetComponent <FieldMovementPattern> (); attacks = GetComponent <AttackPattern> (); if (attacks != null) { attacks.TargetField = fmp.field; attacks.Fire(); } }
// Set enemy attack and move pattern. bool AddAttackAndMovementToNextPrefab(List <EnemyInfo> enemyInfoList, List <Transform> minionTransList, ref int currMinionIndex, ref int savedIndex) { if (savedIndex + currMinionIndex > enemyInfoList.Count - 1) { return(false); } EnemyInfo currInfo = enemyInfoList[savedIndex + currMinionIndex]; // Get all attack pattern component from current enemy, then destroy all leaving only 1. AttackPattern[] currApArray = minionTransList[currMinionIndex].GetComponentsInChildren <AttackPattern>(); for (int i = 1; i < currApArray.Length; i++) { Destroy(currApArray[i]); } // Set attack pattern. AttackPattern currAp = minionTransList[currMinionIndex].GetComponentInChildren <AttackPattern>(); AttackPattern[] infoApArray = currInfo.attackPatternTrans.GetComponents <AttackPattern>(); for (int i = 0; i < infoApArray.Length; i++) { if (i == 0) { currAp.SetAttackPattern(infoApArray[0]); } else { minionTransList[currMinionIndex].transform.GetChild(1).gameObject.AddComponent <AttackPattern>().SetAttackPattern(infoApArray[i]); } } // minionTransList[currMinionIndex].GetComponentInChildren<AttackPattern>().SetAttackPattern(currInfo.attackPattern); // minionTransList[currMinionIndex].GetComponent<Enemy1>().UpdateAttackPattern(); // Set move pattern. minionTransList[currMinionIndex].GetComponent <EnemyMovement>().SetMovement(currInfo.spawnPosition, currInfo.movePattern.movementList[0]); // If the currMinionIndex is over the instantiated prefab count, reset it back to 0(use back the first prefab). if (currMinionIndex + 1 > minionTransList.Count - 1) { savedIndex += currMinionIndex + 1; currMinionIndex = 0; return(false); } else { currMinionIndex++; } return(true); }
void OnCollisionEnter(Collision _col) { if (_col.collider.tag == "Player") { hit = true; } if (_col.collider.tag == "dagger") { attackStates = AttackPattern.RECOIL; health--; Debug.Log("ouch"); } }
private void UpdateAttackPattern() { var randInt = Random.Range(1, 101); if (randInt <= 60) { this.currentAttack = AttackPattern.Basic; } else { this.currentAttack = AttackPattern.Laser; } }
/// <summary> /// Function that determines the enemy's projectile, firerate, /// spread, and projectile speed. /// </summary> /// <param name="mode"> Current Enemy Firemode </param> public override void SetAttackPattern(AttackPattern attackPattern) { base.SetAttackPattern(attackPattern); switch ((int)this.attackPattern) { // pattern One and Three case 0: case 2: default: usePattern = false; fireRate = 1.0f; projectileSpeed = 1.5f; spread = 2; ////canRotate = false; //projectileArray[0] = true; //projectileArray[1] = false; //projectileArray[2] = false; //projectileArray[3] = false; //projectileArray[4] = false; //projectileArray[5] = false; //projectileArray[6] = false; //projectileArray[7] = false; //projectileArray[8] = false; break; // pattern Two and Four case 1: case 3: usePattern = true; fireRate = 1.2f; projectileSpeed = 1.5f; spread = 0; ////canRotate = true; //projectileArray[0] = true; //projectileArray[1] = true; //projectileArray[2] = false; //projectileArray[3] = true; //projectileArray[4] = false; //projectileArray[5] = true; //projectileArray[6] = false; //projectileArray[7] = true; //projectileArray[8] = false; break; } }
/// <summary> /// 左右の向きの符号を返す(Leftはマイナス、Rightはプラス) /// </summary> /// <param name="leftFlag"></param> /// <param name="otherPlayerAttack"></param> /// <returns></returns> int GetSign(bool leftFlag, AttackPattern otherPlayerAttack) { //TODO //このままだと、攻撃終わり(None)の挙動がNG // 肘攻撃の場合は逆向きの為、ここで向きを調節 if (otherPlayerAttack == AttackPattern.Hiji || otherPlayerAttack == AttackPattern.HijiWalk) { return(leftFlag ? +1 : -1); } else { return(leftFlag ? -1 : +1); } }
TileBehavior[] GetTargetsForAttack(TileBehavior from, TileBehavior target, AttackPattern attackPattern) { switch (attackPattern) { case AttackPattern.One: { return(new TileBehavior[] { target }); } case AttackPattern.TwoInARow: { var targets = new TileBehavior[2]; targets[0] = target; Point pos = target.Pos; if (target.Pos.X == from.Pos.X) { if (target.Pos.X > from.Pos.X) { pos.X--; } else { pos.X++; } } else { if (target.Pos.Y > from.Pos.Y) { pos.Y--; } else { pos.Y++; } } targets[1] = LevelMng.Instance.GetTileBehavior(pos); return(targets); } default: break; } return(null); }
/// <summary> /// Function that determines the enemy's projectile, firerate, /// spread, and projectile speed. /// </summary> /// <param name="mode"> Current Enemy Firemode </param> public override void SetAttackPattern(AttackPattern attackPattern) { base.SetAttackPattern(attackPattern); switch ((int)this.attackPattern) { case 0: fireRate = 0.6f; spread = 2; burstFire = 3; break; case 1: fireRate = 1.2f; spread = 0; burstFire = 5; break; } }
public void SetAttackPattern(AttackPattern ap) { ownerType = ap.ownerType; mainBulletDamage = ap.mainBulletDamage; secondaryBulletDamage = ap.secondaryBulletDamage; hpPercentSkipAtk = ap.hpPercentSkipAtk; mainBulletSpeed = ap.mainBulletSpeed; secondaryBulletSpeed = ap.secondaryBulletSpeed; shootDelay = ap.shootDelay; isMainPiercing = ap.isMainPiercing; isSecondaryPiercing = ap.isSecondaryPiercing; pauseEverySec = ap.pauseEverySec; pauseDur = ap.pauseDur; mainBulletIndex = ap.mainBulletIndex; secondaryBulletIndex = ap.secondaryBulletIndex; // Base laser stats. damagePerFrame = ap.damagePerFrame; expandSpeed = ap.expandSpeed; expandTillXScale = ap.expandTillXScale; isDestroyBullets = ap.isDestroyBullets; // Enemy stats. target = ap.target; duration = ap.duration; onceStartDelay = ap.onceStartDelay; isShowDuration = ap.isShowDuration; isPotraitShow = ap.isPotraitShow; isShootPlayer = ap.isShootPlayer; isFollowPlayer = ap.isFollowPlayer; bulletType = ap.bulletType; template = ap.template; // Shoot at player values. initialSpacing = ap.initialSpacing; viewAngle = ap.viewAngle; segments = ap.segments; // Shoot around in circle values. isClockwise = ap.isClockwise; distance = ap.distance; startTurnDelay = ap.startTurnDelay; turningRate = ap.turningRate; increaseTR = ap.increaseTR; increaseTRTime = ap.increaseTRTime; maxTR = ap.maxTR; xOffset = ap.xOffset; yOffset = ap.yOffset; speedChangeList = ap.speedChangeList; // Sine wave values. offsetPosition = ap.offsetPosition; frequency = ap.frequency; magnitude = ap.magnitude; magExpandMult = ap.magExpandMult; sineWaveBullets = ap.sineWaveBullets; cooldown = ap.cooldown; // Shock repel values. giveStatRepelDur = ap.giveStatRepelDur; slowValue = ap.slowValue; repelValue = ap.repelValue; trapDelayExpand = ap.trapDelayExpand; trapExpandDur = ap.trapExpandDur; trapExpandSpd = ap.trapExpandSpd; trapRotateSpd = ap.trapRotateSpd; trapMoveSpd = ap.trapMoveSpd; trapDelayShrink = ap.trapDelayShrink; trapShrinkSpd = ap.trapShrinkSpd; trapFadeSpd = ap.trapFadeSpd; }
/// <summary> /// Function that determines the enemy's projectile, firerate, /// spread, and projectile speed. /// </summary> /// <param name="mode">Current Enemy Firemode</param> public override void SetAttackPattern(AttackPattern attackPattern) { base.SetAttackPattern(attackPattern); switch ((int)this.attackPattern) { //standard pattern, single bullets case 0: patternId = patternIds[0]; //fireRate = 0.8f; //projectileSpeed = 1.5f; //spread = 0; ////canRotate = false; //projectileArray[0] = true; //projectileArray[1] = false; //projectileArray[2] = false; //projectileArray[3] = false; //projectileArray[4] = true; //projectileArray[5] = false; //projectileArray[6] = true; //projectileArray[7] = false; //projectileArray[8] = false; break; case 1: patternId = patternIds[1]; //fireRate = 0.8f; //projectileSpeed = 1.5f; //spread = 0; ////canRotate = true; //projectileArray[0] = false; //projectileArray[1] = true; //projectileArray[2] = true; //projectileArray[3] = true; //projectileArray[4] = true; //projectileArray[5] = true; //projectileArray[6] = true; //projectileArray[7] = true; //projectileArray[8] = true; break; } }
/// <summary> /// Function that determines the enemy's projectile, firerate, /// spread, and projectile speed. /// </summary> /// <param name="mode">Current Enemy Firemode</param> public override void SetAttackPattern(AttackPattern attackPattern) { base.SetAttackPattern(attackPattern); switch ((int)this.attackPattern) { //standard pattern, single bullets case 0: fireRate = 1.0f; projectileSpeed = 1.5f; spread = 0; projectileCount = 1; //canRotate = false; //projectileArray[0] = true; //projectileArray[1] = true; //projectileArray[2] = true; //projectileArray[3] = true; //projectileArray[4] = true; //projectileArray[5] = true; //projectileArray[6] = true; //projectileArray[7] = true; //projectileArray[8] = true; break; case 1: fireRate = 1.2f; projectileSpeed = 1.5f; spread = 0.5f; projectileCount = 3; //canRotate = true; //projectileArray[0] = false; //projectileArray[1] = false; //projectileArray[2] = true; //projectileArray[3] = false; //projectileArray[4] = true; //projectileArray[5] = false; //projectileArray[6] = true; //projectileArray[7] = false; //projectileArray[8] = true; break; } }
void OnGUI() { /***********************************/ //Header /***********************************/ GUILayout.Label("Attack Data Editor", EditorStyles.boldLabel); if (attackDataList == null) { EditorGUILayout.LabelField("No Attack database available, error."); } /******************************************/ //Sanity Checks and setups /******************************************/ GUILayout.Space(20); if (attackDataList.attackList == null) { Debug.Log("New List was made"); attackDataList.attackList = new List<AttackData>(); toggledIndex = 0; } if (buttonToggled == null || buttonToggled.Count < attackDataList.attackList.Count) { buttonToggled = new List<bool>(); toggledIndex = 0; for (int i = 0; i < attackDataList.attackList.Count; i++) buttonToggled.Add(false); } if (toggledIndex > attackDataList.attackList.Count) { Debug.Log("Index was out of bounds"); toggledIndex = attackDataList.attackList.Count - 1; } /************************************************************/ /******************************************/ //Display things /******************************************/ if (attackDataList != null) { GUILayout.BeginHorizontal(); GUILayout.Space(10); if (GUILayout.Button("Prev", GUILayout.ExpandWidth(false))) { findPrev(); } GUILayout.Space(5); if (GUILayout.Button("Next", GUILayout.ExpandWidth(false))) { findNext(); } GUILayout.Space(60); if (GUILayout.Button("Add Item", GUILayout.ExpandWidth(false))) { AddAttack(); attackDataList.attackList[toggledIndex].pattern = filterPattern; } if (GUILayout.Button("Delete Item", GUILayout.ExpandWidth(false))) { DeleteAttack(toggledIndex); } filterPattern = (AttackPattern)EditorGUILayout.EnumPopup(filterPattern); if (GUILayout.Button("Sort", GUILayout.ExpandWidth(false))) { sortByName(); } GUILayout.EndHorizontal(); if (attackDataList.attackList == null) Debug.Log("Mistakes were made - You should never reach this"); /****************************************/ //How the list will look /***************************************/ if (attackDataList.attackList.Count > 0) { if(attackDataList.attackList[toggledIndex].pattern != filterPattern) { toggledIndex = 0; findNext(); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); //----------Show all the buttons----------- showScrollButtons(); //----------------------------------------- EditorGUILayout.EndVertical(); GUILayout.Space(5); EditorGUILayout.BeginVertical(); //---------Current selection info----------- GUILayout.BeginHorizontal(); attackDataList.attackList[toggledIndex].aName = EditorGUILayout.TextField("Attack Name", attackDataList.attackList[toggledIndex].aName as string); attackDataList.attackList[toggledIndex].pattern = (AttackPattern)EditorGUILayout.EnumPopup("Attack Pattern", attackDataList.attackList[toggledIndex].pattern); if (attackDataList.attackList[toggledIndex].pattern != filterPattern) filterPattern = attackDataList.attackList[toggledIndex].pattern; GUILayout.EndHorizontal(); GUILayout.Space(10); attackDataList.attackList[toggledIndex].range = EditorGUILayout.Slider("Range", attackDataList.attackList[toggledIndex].range, 4f, 30f); if (attackDataList.attackList[toggledIndex].pattern != AttackPattern.SINGLE) attackDataList.attackList[toggledIndex].radius = EditorGUILayout.Slider("Radius", attackDataList.attackList[toggledIndex].radius, 4f, 30f); GUILayout.Space(10); attackDataList.attackList[toggledIndex].dmg = EditorGUILayout.IntSlider("Damage/Success", attackDataList.attackList[toggledIndex].dmg, 1, 5); attackDataList.attackList[toggledIndex].nDice = EditorGUILayout.IntSlider("Number of rolls", attackDataList.attackList[toggledIndex].nDice, 1, 10); attackDataList.attackList[toggledIndex].roll = EditorGUILayout.IntSlider("%Success/Roll", attackDataList.attackList[toggledIndex].roll, 1, 100); //Display Damage types--------------------------- GUILayout.Space(10); EditorGUILayout.LabelField("Attack Damage Type", EditorStyles.boldLabel); GUILayout.Space(10); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); foreach (DamageType x in attackDataList.attackList[toggledIndex].dmgTypes.ToList()) { if (GUILayout.Button(x.ToString())) attackDataList.attackList[toggledIndex].dmgTypes.Remove(x); } GUILayout.EndVertical(); currentDmgType = (DamageType)EditorGUILayout.EnumPopup("Damage Type", currentDmgType); if (GUILayout.Button("Add")) if (!attackDataList.attackList[toggledIndex].dmgTypes.Contains(currentDmgType)) attackDataList.attackList[toggledIndex].dmgTypes.Add(currentDmgType); GUILayout.EndHorizontal(); //--------------------------------------------- GUILayout.Space(10); EditorGUILayout.LabelField("Attack Stats Summary", EditorStyles.boldLabel); GUILayout.Space(10); GUILayout.BeginHorizontal(); string expected = "Expected: " + (attackDataList.attackList[toggledIndex].dmg * attackDataList.attackList[toggledIndex].nDice * ((float)attackDataList.attackList[toggledIndex].roll/100)).ToString(); EditorGUILayout.LabelField(expected); attackDataList.attackList[toggledIndex].expectedMin = calculateMin(attackDataList.attackList[toggledIndex].nDice, attackDataList.attackList[toggledIndex].roll) * attackDataList.attackList[toggledIndex].dmg; attackDataList.attackList[toggledIndex].expectedMax = calculateMax(attackDataList.attackList[toggledIndex].nDice, attackDataList.attackList[toggledIndex].roll) * attackDataList.attackList[toggledIndex].dmg; string expectedRange = "Damage Range : " + attackDataList.attackList[toggledIndex].expectedMin.ToString() + " - " + attackDataList.attackList[toggledIndex].expectedMax.ToString(); EditorGUILayout.LabelField(expectedRange); GUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUILayout.EndHorizontal(); } else { GUILayout.Label("This Attack List is Empty."); } if (GUI.changed) { EditorUtility.SetDirty(attackDataList); } } }
protected override void ActivateAbility() { //do camera shake stuff here; // Debug.Log("sad"); //Vibrate(5f); switch (attackStates) { case AttackPattern.SHAKE: Invoke("WaitTime", 3f); Debug.Log("Vibrato"); //Util.Shake(gameObject, 5f); //Vibrate(5f); Vibrate(); if (ready2) { attackStates = AttackPattern.DASH; ready2 = false; CancelInvoke(); } break; case AttackPattern.DASH: Invoke("WaitTime", 3f); agent.SetDestination(player.position); //agent.speed = 7; agent.speed = Mathf.Clamp(agent.speed * 2, 1, 10); agent.autoBraking = false; if (ready2) { attackStates = AttackPattern.SHAKE; ready2 = false; agent.speed = 3.5f; agent.ResetPath(); CancelInvoke(); } else if (hit) { attackStates = AttackPattern.IDLE; agent.ResetPath(); agent.speed = 3.5f; agent.autoBraking = true; CancelInvoke(); hit = false; ready2 = false; } break; case AttackPattern.IDLE: Invoke("WaitTime", 2f); //Debug.Log("idle"); if (ready2) { attackStates = AttackPattern.SHAKE; ready2 = false; CancelInvoke(); } break; case AttackPattern.RECOIL: //play recoil animation; agent.ResetPath(); agent.speed = 3.5f; agent.autoBraking = true; CancelInvoke(); hit = false; ready2 = false; attackStates = AttackPattern.IDLE; break; } //agent.SetDestination(player.position); }
void OnGUI() { if (atkDataList == null) { string objectPath = EditorPrefs.GetString("AttackDatabasePath"); atkDataList = AssetDatabase.LoadAssetAtPath(objectPath, typeof(AttackDataList)) as AttackDataList; } if(isCardEdit && cardDataBase == null) { cardDataBase = (CardDatabase)EditorWindow.GetWindow(typeof(CardDatabase)); unitDataBase = null; } else if(!isCardEdit && unitDataBase == null) { unitDataBase = (UnitDatabase)EditorWindow.GetWindow(typeof(UnitDatabase)); cardDataBase = null; } if(atkDataList.attackList.Count == 0) EditorGUILayout.LabelField("Attack List Data Not Available", EditorStyles.boldLabel); else { if (buttonToggled == null || buttonToggled.Count < atkDataList.attackList.Count) { buttonToggled = new List<bool>(); toggledIndex = 0; for (int i = 0; i < atkDataList.attackList.Count; i++) buttonToggled.Add(false); } //Filter list or something EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Attack List Data", EditorStyles.boldLabel); filterPattern = (AttackPattern)EditorGUILayout.EnumPopup(filterPattern); if (GUILayout.Button("Sort", GUILayout.ExpandWidth(false))) { sortByName(); } GUILayout.EndHorizontal(); //Show the list EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(GUILayout.Width(180)); showScrollButtons(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(); showAttackSummary(); if(isCardEdit) { if (GUILayout.Button("Link this attack")) { cardDataBase.assignElement(atkDataList.attackList[toggledIndex].uniqueId); cardDataBase.Repaint(); } } else { if (GUILayout.Button("Add this attack")) { unitDataBase.AddAttack(unitDataBase.toggledIndex, atkDataList.attackList[toggledIndex].uniqueId); unitDataBase.Repaint(); } } EditorGUILayout.EndVertical(); GUILayout.EndHorizontal(); } }
public Wave AddAttackPattern(int numOfEnemies, int numOfMeteors, float duration) { AttackPattern newPattern = new AttackPattern (numOfEnemies, numOfMeteors, duration); waveParts.Add(newPattern); return this; }