public void SetPrivates() { _characterBhv = GetComponent <CharacterBhv>(); _opponentBhv = _characterBhv.OpponentBhvs[0]; _gridBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <GridBhv>(); _fightSceneBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <FightSceneBhv>(); }
public override void OnClick() { if (!IsUnderCooldown()) { GridBhv.ShowSkillRange(RangeType, CharacterBhv, Id, OpponentBhvs, true); } }
public virtual void Init(CharacterBhv characterBhv, List <CharacterBhv> opponentBhvs, GridBhv gridBhv, int id) { CharacterBhv = characterBhv; OpponentBhvs = opponentBhvs; GridBhv = gridBhv; Id = id; }
public override void Activate(int x, int y) { base.Activate(x, y); CharacterBhv.StartCoroutine(Helper.ExecuteAfterDelay(PlayerPrefsHelper.GetSpeed(), () => { CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[x, y].transform.position, null, EffectId, Constants.GridMax - CharacterBhv.Y); Debuff(GridBhv.IsOpponentOnCell(x, y)); AfterActivation(); return(true); })); }
public override void Activate(int x, int y) { base.Activate(x, y); CharacterBhv.StartCoroutine(Helper.ExecuteAfterDelay(PlayerPrefsHelper.GetSpeed(), () => { var result = Grap(GridBhv.IsOpponentOnCell(x, y)); if (result == false) { AfterGrap(); } return(true); })); }
public override void SetPrivates() { base.SetPrivates(); _fightSceneBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <FightSceneBhv>(); _gridBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <GridBhv>(); _soundControler = GameObject.Find(Constants.TagSoundControler).GetComponent <SoundControlerBhv>(); _isStretching = false; _resetedScale = new Vector3(1.0f, 1.0f, 1.0f); _pressedScale = new Vector3(1.1f, 1.1f, 1.0f); _onSprite = transform.Find("OnSprite").GetComponent <SpriteRenderer>(); _offSprite = transform.Find("OffSprite").GetComponent <SpriteRenderer>(); _overSprite = transform.Find("OverSprite").GetComponent <SpriteRenderer>(); SetStartVisuals(); }
public override int OnTakeDamage(int damages) { if (IsApplyingEffect()) { if (Helper.IsPosValid(_currentTargetX, _currentTargetX) && !GridBhv.IsOpponentOnCell(_currentTargetX, _currentTargetY, true, true)) { CharacterBhv.MoveToPosition(_currentTargetX, _currentTargetY, false); CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[_currentTargetX, _currentTargetY].transform.position, null, EffectId, Constants.GridMax - _currentTargetY); } EffectDuration = 0; CharacterBhv.LoseSkillEffect(Effect); return(0); } return(damages); }
protected override void SetPrivates() { base.SetPrivates(); PauseMenu = Instantiator.NewPauseMenu(); OnRootPreviousScene = Constants.SwipeScene; _gridBhv = GetComponent <GridBhv>(); _map = MapsData.EasyMaps[Random.Range(0, MapsData.EasyMaps.Count)]; _healthBar = GameObject.Find("HealthBar")?.GetComponent <ResourceBarBhv>(); _xpBar = GameObject.Find("XpBar")?.GetComponent <ResourceBarBhv>(); _fightTitle = GameObject.Find("FightTitle")?.GetComponent <TMPro.TextMeshPro>(); _orbHp = GameObject.Find("Hp")?.GetComponent <OrbBhv>(); _orbPa = GameObject.Find("Pa")?.GetComponent <OrbBhv>(); _orbPm = GameObject.Find("Pm")?.GetComponent <OrbBhv>(); _hidePosition = new Vector3(-10.0f, 10.0f, 0.0f); }
public void SetPrivates() { _fightSceneBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <FightSceneBhv>(); _gridBhv = GameObject.Find(Constants.GoSceneBhvName).GetComponent <GridBhv>(); OpponentBhvs = new List <CharacterBhv>(); if (Character.IsPlayer) { int nbOpponents = PlayerPrefs.GetInt(Constants.PpNbOpponents); for (int i = 0; i < nbOpponents; ++i) { OpponentBhvs.Add(GameObject.Find(Constants.GoOpponentName + i).GetComponent <CharacterBhv>()); } } else { OpponentBhvs.Add(GameObject.Find(Constants.GoPlayerName).GetComponent <CharacterBhv>()); Ai = gameObject.AddComponent <AiBhv>(); Ai.SetPrivates(); } Instantiator = _fightSceneBhv.Instantiator; SkinContainer = transform.Find("SkinContainer").GetComponent <SkinContainerBhv>(); for (int i = 0; i < Character.Skills.Count; ++i) { if (Character.Skills[i] != null) { Character.Skills[i].Init(this, OpponentBhvs, _gridBhv, i); } } if (Character.IsPlayer) { _orbPa = GameObject.Find("Pa")?.GetComponent <OrbBhv>(); _orbPm = GameObject.Find("Pm")?.GetComponent <OrbBhv>(); } Pa = Character.PaMax; Pm = Character.PmMax; }
public bool Push(CharacterBhv pushedOpponentBhv) { _pushedOpponentBhv = pushedOpponentBhv; if (_pushedOpponentBhv == null) { return(false); } int x = _pushedOpponentBhv.X - CharacterBhv.X; int y = _pushedOpponentBhv.Y - CharacterBhv.Y; if (!Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) || GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type != CellType.On || GridBhv.IsOpponentOnCell(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, true)) { if ((Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) && GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.Off) || GridBhv.IsOpponentOnCell(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, true)) { var floatAmount = 30.0f * CharacterBhv.Character.GetDamageMultiplier(); //pushedOpponentBhv.TakeDamages(new Damage((int)floatAmount)); var damage = new Damage((int)floatAmount); CharacterBhv.Instantiator.PopText("-" + pushedOpponentBhv.Character.TakeDamages(damage.Amount).ToString(), pushedOpponentBhv.transform.position, damage.Critical ? TextType.HpCritical : TextType.Hp); pushedOpponentBhv.SkinContainer.OnHit(); } else if (!Helper.IsPosValid(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y) || GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].GetComponent <CellBhv>().Type == CellType.Impracticable) { pushedOpponentBhv.LosePm(1); } return(false); } _pushedOpponentBhv.AfterMouvementDelegate = AfterPush; _pushedOpponentBhv.MoveToPosition(_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y, false); CharacterBhv.Instantiator.NewEffect(InventoryItemType.Skill, GridBhv.Cells[_pushedOpponentBhv.X + x, _pushedOpponentBhv.Y + y].transform.position, null, EffectId, Constants.GridMax - (_pushedOpponentBhv.Y + y)); return(true); }