// Start is called before the first frame update void Start() { characterController = GetComponent <CharacterController>(); rigidBody = GetComponent <Rigidbody>(); mainCamera = Camera.main.transform; currentMoveSpeed = moveSpeed; axisXPlayer = UpdateXAxis; axisYPlayer = UpdateYAxis; animator = GetComponent <Animator>(); charm = AnimationCharm; music = FindObjectOfType <MusicMgr>(); music.musicUpdate += CameraFieldOfView; if (SaveOptions.instance != null) { UpdateXAxis(SaveOptions.instance.invertXAxis); UpdateYAxis(SaveOptions.instance.invertYAxis); } hitsource.playOnAwake = false; }
public void init(GameObject obj) { parent = obj; direction = obj.transform.forward; direction = direction.normalized; ps.startRotation3D = obj.transform.rotation.eulerAngles; Charm charm = parent.GetComponent <Charm>(); switch (charm.CurrentLevel) { case 0: duration = 1.4f; break; case 1: duration = 1.55f; break; case 2: duration = 1.7f; break; case 3: duration = 1.85f; break; case 4: duration = 2.0f; break; } }
private void OnTriggerEnter(Collider other) { if (other.gameObject == parent) { return; } if (other.CompareTag(parent.transform.tag == "Red" ? "Blue" : "Red")) { Vector3 pos = new Vector3(0, 0, 0); GameObject Effecter = Instantiate(Effect, pos, Quaternion.identity, other.transform); SoundManager.instance.PlaySE("SFX_charmHit", Effecter); Effecter.GetComponent <CharmEffect>().initialize(parent); Charm charm = parent.GetComponent <Charm>(); Units unit = parent.GetComponent <Units>(); float Damage = unit.Attack(AttackType.AP_SKILL, charm.skillFactor, charm.LevelperValues[charm.CurrentLevel].addDamage); float Suffer = 0.0f; if (other.TryGetComponent <Units>(out var script)) { Suffer = script.hit(AttackType.AP_SKILL, Damage, parent.GetComponent <Ahri>(), unit.UnitStatus.magicResist); } Debug.Log("Damage = " + Damage + " / " + "Suffer = " + Suffer); } Object.Destroy(this.gameObject); }
public void activate(Charm _charm, int _order) { charm = _charm; order = _order; if (needPosInfo) { needPosInfo = false; topLeftPoint = GameObject.Find("charmTopLeft").transform.position; } isActive = true; gameObject.SetActive(true); gameObject.name = "charm " + charm.name + " " + order; nameField.text = charm.name; descField.text = charm.description; mouseIsOver = false; int col = order / numCharmsPerCol; int row = order % numCharmsPerCol; transform.position = topLeftPoint + new Vector3(spacing.x * col, spacing.y * row, spacing.z * row); }
public void activate(Charm _charm) { charm = _charm; isActive = true; //check if this is redundant if (GameObjectManager.instance.checkForDuplicateCharmGO(this) == true) { deactivate(); return; } if (canvas == null) { canvas = GetComponentInChildren <Canvas> (); } gameObject.SetActive(true); //if (needsPositions == true) { //needsPositions = false; startPosPlayer = GameObject.Find("charm_player_startPos").transform.position; endPosPlayer = GameObject.Find("charm_player_endPos").transform.position; startPosAI = GameObject.Find("charm_ai_startPos").transform.position; endPosAI = GameObject.Find("charm_ai_endPos").transform.position; //} startAnchor = charm.Owner.isPlayerControlled ? startPosPlayer : startPosAI; endAnchor = charm.Owner.isPlayerControlled ? endPosPlayer : endPosAI; gameObject.name = "charm " + charm.Owner.unitName + " " + charm.name; setAnimationPositions(); StartCoroutine(doMoveAnimation(startPos, endPos, moveTime, false)); }
public void setAsInactive() { cardsToAdd.Clear(); weaponToAdd = null; charmToAdd = null; }
public DBDeck(XmlNode node, int _order) { //general stuff idName = node.Attributes ["idName"].Value; displayName = node ["name"].InnerXml; spriteName = node ["sprite"].InnerXml; sprite = Resources.Load <Sprite> (spriteName); order = _order; //deck deckListShortName = node ["deck"].InnerXml; deckListPath = Application.dataPath + "/external_data/player/decks/" + deckListShortName + ".txt"; cards = CardManager.instance.getDeckFromTextFile(deckListPath); for (int i = 0; i < cards.Count; i++) { cards [i].setup(null, null); } //charms XmlNodeList childNodes = node["charms"].ChildNodes; foreach (XmlNode n in childNodes) { if (n.Name == "charm") { string charmID = n.InnerXml; if (charmID.Length > 1) { Charm thisCharm = CharmManager.instance.getCharmFromIdName(charmID); thisCharm.setup(null, false, charmID); curCharm = thisCharm; } } } }
public void deactivate() { charm = null; isActive = false; gameObject.SetActive(false); gameObject.name = "charm unused"; }
public void CharmTest() { var charm = new Charm(); Assert.AreEqual((2 / 3), charm.Charge); Assert.AreEqual(0, charm.Strangeness); }
private async Task LoadCharmsData(ILogger logger) { IList <CharmPrimitive> result = await LoadBase <CharmPrimitive>("charms", logger); if (result == null) { return; } var localCharms = new ICharm[result.Count]; for (int i = 0; i < localCharms.Length; i++) { CharmPrimitive currentCharmPrimitive = result[i]; var charmLevels = new DataStructures.CharmLevel[currentCharmPrimitive.Levels.Count]; for (int j = 0; j < charmLevels.Length; j++) { IAbility[] localAbilities = currentCharmPrimitive.Levels[j].Abilitites.Select(x => CreateAbility(x.SkillId, x.Level)).ToArray(); charmLevels[j] = new DataStructures.CharmLevel(i + 1, currentCharmPrimitive.Levels[j], localAbilities); } localCharms[i] = new Charm(i + 1, currentCharmPrimitive.Name, charmLevels); } charms = localCharms; }
public Charm CreateBurstCharm() { Charm charm = new Charm("Burst Charm", CharmType.Burst, 1.0f, charmSprite, Color.Blue); charm.ID = 3; charm.Tooltip = "Your ranged weapons have 1 extra burst."; return(charm); }
public Charm CreateHigherCooldown() { Charm charm = new Charm("Impact Charm", CharmType.HigherCooldown, 2f, charmSprite, Color.Crimson); charm.ID = 2; charm.Tooltip = "Your weapons deal twice as much damage, but their cooldown is twice as long."; return(charm); }
public Charm CreateLowerCooldown() { Charm charm = new Charm("Overclock Charm", CharmType.LowerCooldown, 2f, charmSprite, Color.Orange); charm.ID = 1; charm.Tooltip = "Your weapons' cooldowns are half as long, but they deal half as much damage."; return(charm); }
public Charm CreateEmptyCharm() { Charm charm = new Charm("Empty Charm", CharmType.Blank, 0f, charmSprite, Color.White); charm.ID = 0; charm.Tooltip = "This charm does nothing."; return(charm); }
public virtual void setFromParentCustom(Charm parent) { Charm_LatchOn p = (Charm_LatchOn)parent; targetUnit = p.targetUnit; needsTarget = p.needsTarget; otherPosWhenLatched = new TilePos(p.otherPosWhenLatched); }
public Charm CreateLifestealCharm() { Charm charm = new Charm("Vampiric Charm", CharmType.Lifesteal, 0.4f, charmSprite, Color.DarkViolet); charm.ID = 5; charm.Tooltip = "Your melee attacks heal you for " + (charm.Strength * 100).ToString() + "% of damage dealt. You cannot take the Heal option in the Trade menu."; return(charm); }
public Charm CreateSpeedCharm() { Charm charm = new Charm("Speed Charm", CharmType.Speed, 1.3f, charmSprite, Color.LimeGreen); charm.ID = 4; charm.Tooltip = "Your speed is increased by 30%."; return(charm); }
public override void passInUnitCustom(Unit unit) { Owner.board.clearHighlights(); Charm newEquipment = unit.addCharm(idNameOfEquipment); newEquipment.storeCard(this); //unit.aiSimHasBeenAidedCount++; finish(true); }
public override void acquires(GameObject obj) { if (obj.tag == "charm") { Charm charm = obj.GetComponent <Charm>(); points += charm.GetPoints; audio.PlayOneShot(acquireSound, 1.0f); } }
public override void Update(GameTime gameTime) { KeyboardState keyboard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); if (keyboard.IsKeyDown(Keys.Home)) { saveGameOverrideEnabled = true; } if (resetButton.CollisionRectangle.Contains(mouse.Position) && mouse.LeftButton == ButtonState.Pressed) { weapon1 = oldWeapon1; weapon2 = oldWeapon2; shield1 = oldShield1; charm1 = oldCharm1; playerIsHealing = false; } if (healingButton.CollisionRectangle.Contains(mouse.Position) && mouse.LeftButton == ButtonState.Pressed && oldCharm1.Type != CharmType.Lifesteal) { weapon1 = oldWeapon1; weapon2 = oldWeapon2; shield1 = oldShield1; charm1 = oldCharm1; playerIsHealing = true; } if (((level - 1) % 10 == 0 || saveGameOverrideEnabled) && saveButton.CollisionRectangle.Contains(mouse.Position) && mouse.LeftButton == ButtonState.Pressed) { ScreenChanged(new SaveGameScreen(ScreenChanged, TradeContents)); //fileSelected = -1; //for (int i = 0; i < NumberOfSaves; i++) // CheckGameData(i, levelData, weapon1ItemBoxes, weapon2ItemBoxes, shield1ItemBoxes, charm1ItemBoxes); } DoItemBoxUpdate(mouse, tradeItemBoxes, tradeItemBoxBackgrounds, equippedItemBoxes); //playerTradeMenuHealth.Update(gameTime, player1); Health bar does not need to update as it is not moving if (playerIsHealing) { Health = oldHealth + GameConstants.PLAYER_MAX_HIT_POINTS / 2; if (Health > GameConstants.PLAYER_MAX_HIT_POINTS) { Health = GameConstants.PLAYER_MAX_HIT_POINTS; } } else { Health = oldHealth; } if (playButton.CollisionRectangle.Contains(new Vector2(mouse.X, mouse.Y)) && mouse.LeftButton == ButtonState.Pressed && !leftMousePreviouslyPressed) { TradeScreenContents tradeContents = new TradeScreenContents(Health, level, weapon1, weapon2, shield1, charm1); ScreenChanged(new CombatScreen(ScreenChanged, tradeContents)); } leftMousePreviouslyPressed = mouse.LeftButton == ButtonState.Pressed; }
//Used to create the first combat screen from main menu. TODO: Should refactor so this is not necessary public TradeScreenContents(float health, int level, Weapon weapon1, Weapon weapon2, Shield shield1, Charm charm1) { Health = health; Level = level; Weapon1 = weapon1; Weapon2 = weapon2; Shield1 = shield1; Charm1 = charm1; }
public void setAsActive() { for (int i = 0; i < cards.Count; i++) { DBManagerInterface.instance.getCardGO().activate(cards[i], i, false); } cardsToAdd.Clear(); weaponToAdd = null; charmToAdd = null; }
public async Task <Guid> AddAsync(string name, string nameEng, decimal price, Guid charmCategoryId) { var category = await charmCategoryRepository.GetAndEnsureExistAsync(charmCategoryId); var charm = new Charm(name, nameEng, null, price); category.AddCharm(charm); await charmCategoryRepository.SaveChangesAsync(); return(charm.Id); }
public override int AttackProc(Character enemy, int damage) { if (Random.Int(3) != 0) { return(damage); } buffs.Buff.Affect <Charm>(enemy, Charm.durationFactor(enemy) * Random.IntRange(2, 5)); enemy.Sprite.CenterEmitter().Start(Speck.Factory(Speck.HEART), 0.2f, 5); Sample.Instance.Play(Assets.SND_CHARMS); return(damage); }
bool CanAccessCharms(Character character, Charm charm) { bool canAccess = character.essence >= charm.MinEssence && character.abilities[(int)charm.Ability] >= charm.MinAbility; if (charm.Prerequisites != null) { foreach (string pre in charm.Prerequisites) { canAccess = canAccess && character.charmReference.Contains(pre); } } return(canAccess); }
public static int HasSlotTypeCount(this Charm charm, SlotType slotType) { if (charm == null) { return(0); } else { return((charm?.Slot1?.Type == slotType ? 1 : 0) + (charm?.Slot2?.Type == slotType ? 1 : 0) + (charm?.Slot3?.Type == slotType ? 1 : 0)); } }
public Charm addCharm(string idName) { Charm thisCharm = CharmManager.instance.getCharmFromIdName(idName); charms.Add(thisCharm); thisCharm.setup(this, useGO, idName); if (isActive) { thisCharm.setActive(true); } return(thisCharm); }
public void saveChanges() { //check if charms have been changed if (charmToAdd != null) { curCharm = charmToAdd; } //add everything in the to-add list to the deck and then clear it for (int i = 0; i < cardsToAdd.Count; i++) { cards.Add(cardsToAdd [i]); } cardsToAdd.Clear(); }
public Enemy CreateFireSpider(Vector2 location) { Enemy enemy; Texture2D sprite = creatureLoader.Get("fireSpider1"); int hitPoints = 25; float baseSpeed = 0.00001f; Weapon weapon = weaponFactory.CreateFireball(); Charm charm = charmFactory.CreateLowerCooldown(); enemy = new Enemy("Fire Spider", location, 5, sprite, new Vector2(0, 0), hitPoints, healthBarSprite, weapon, blankW, blankS, charm, baseSpeed, pathfinder.Copy()); enemy.SourceRectangle = new Rectangle(0, 0, sprite.Height, sprite.Height); //So that animations work - each individual frame is square enemy.UpdateDrawRectangleAnimated(); return(enemy); }
public TradeScreenContents(float health, int level, Weapon weapon1, Weapon weapon2, Shield shield1, Charm charm1, Item item1, Item item2, Item item3) { Health = health; Level = level; Weapon1 = weapon1; Weapon2 = weapon2; Shield1 = shield1; Charm1 = charm1; Item1 = item1; Item2 = item2; Item3 = item3; }