public void SetData(DataAttack data) { this.data = data; foreach (DataAttackNext dan in data.nextAttacks) { nextAttacks.Add(new BossAttackNext(boss, dan, mgLevel)); } elseAttack = boss.GetAttack(data.elseNextAttack); }
public void AddAttack(DataAttack da) { var ba = da.AddComponent(gameObject); attacks.Add(da, ba); if (da.firstAttack.value) { firstAttacks.Add(ba); } }
public void LoadAttack(DataAttack da) { attack = da; var type = da.GetType(); //Create key values kvSpawner.Clear(); nameInputField = kvSpawner.SpawnInputField("Name:", InputField.ContentType.Standard, da.name); kvSpawner.SpawnText("Attack type:", da.type); kvSpawner.SpawnInputField("Startup time:", InputField.ContentType.DecimalNumber, da.timeStart); kvSpawner.SpawnInputField("Recovery time:", InputField.ContentType.DecimalNumber, da.timeEnd); kvSpawner.SpawnToggle("Can be first attack:", da.firstAttack); if (type == typeof(DataAttackJump)) { DataAttackJump d = (DataAttackJump)da; kvSpawner.SpawnSlider("Jump time:", 0.1f, 0.6f, d.jumpTime); kvSpawner.SpawnSlider("Jump speed:", 3f, 6f, d.jumpSpeed); kvSpawner.SpawnSlider("Fall speed:", 4f, 6f, d.fallSpeed); kvSpawner.SpawnSlider("Move speed:", 0f, 0.2f, d.moveSpeed); kvSpawner.SpawnListButton("Move approach to player:", M.GetListOfEnum(typeof(Approach)), d.approachToPlayer); } else if (type == typeof(DataAttackShoot)) { DataAttackShoot d = (DataAttackShoot)da; kvSpawner.SpawnListButton("Projectile direction type:", M.GetListOfEnum(typeof(ProjectileDirection)), d.projectileDirection); kvSpawner.SpawnSlider("Amount:", 1, 50, d.projectileAmount); kvSpawner.SpawnSlider("Size:", 0.05f, 0.5f, d.scale); kvSpawner.SpawnSlider("Movement speed:", 0.01f, 0.2f, d.speedMove); kvSpawner.SpawnSlider("Homing speed:", 0f, 2f, d.speedRotation); kvSpawner.SpawnInputField("Spawn delay:", InputField.ContentType.DecimalNumber, d.spawnDelay); kvSpawner.SpawnToggle("Turn towards player:", d.facePlayer); } //Load Next Attacks ClearNextAttacks(); foreach (DataAttackNext next in da.nextAttacks) { LoadNextAttackPanel(next); } var elseAttack = (da.elseNextAttack == null) ? attack : da.elseNextAttack; SetElseAttackNext(elseAttack); }
void CreateAttack(string type) { DataAttack da = null; switch (type) { case "JUMP": da = new DataAttackJump(); break; case "PROJECTILE": da = new DataAttackShoot(); break; default: break; } da.type.value = type; attacks.Add(da); mgPanel.Forward(panelEditAttack); mgEditAttack.LoadAttack(da); }
public AttackModel AttackMaker(DataAttack da)//puts data in every attacks { return(new AttackModel(da.AttackInfo.attackName, da.AttackInfo.damage, new Vector2(da.AttackInfo.distance, da.AttackInfo.distance), da.AttackInfo.zone, da.AttackInfo.cost)); }
public int GetAttackIndex(DataAttack da) { return(attacks.IndexOf(da)); }
public void DeleteAttack(DataAttack da) { attacks.Remove(da); }
void EditAttack(DataAttack da) { mgPanel.Forward(panelEditAttack); mgEditAttack.LoadAttack(da); }
void SetElseAttackNext(DataAttack da) { buttonElseAttackNext.GetComponentInChildren <Text>().text = (da == attack) ? "This attack" : da.name.value; attack.elseNextAttack = da; }
public BossAttack GetAttack(DataAttack da) { return(attacks[da]); }