private void Start() { gridmaster = (SuperGrids)FindObjectOfType(typeof(SuperGrids)); heroTest = (HeroBase)FindObjectOfType(typeof(HeroBase)); GetTile(); }
private void OnTriggerEnter(Collider other) { //print("tripped"); HeroBase hb = other.GetComponent <HeroBase>(); if (hb != null) { if (hb.HeroType == HeroBase.HeroTypes.Tree) { if (SpawnTriggerType == SpawnTriggerTypes.Village && TripInfo.CurrentTrigger == SpawnTriggerTypes.Village) { if (hb.SicknessLevel == CharacterBase.CharacterSickness.None) { //next stage TripInfo.NextStage(); TripInfo.CurrentTrigger = SpawnTriggerTypes.Well; } } else { if (hb.SicknessLevel == CharacterBase.CharacterSickness.Water && TripInfo.CurrentTrigger == SpawnTriggerTypes.Well) { //next stage TripInfo.NextStage(); TripInfo.CurrentTrigger = SpawnTriggerTypes.Village; } } } } }
public HeroBase Fight(HeroBase hero1, HeroBase hero2, TerrainBase terrain) { terrain.ApplyEffects(new List <HeroBase> { hero1, hero2 }); return(Fight(hero1, hero2)); }
void Start() { HeroBase p1 = new HeroBase(12, 14, 9, 14); p1.addModifier(new ArmsStrength()); HeroBase p2 = new HeroBase(12, 14, 9, 14); p2.addModifier(new ArmsStrength()); int rounds = 0; string msg; while (true) { rounds++; attack("P1", p1, p2); if (p2.isDead()) { msg = "P2 is dead"; Debug.Log(msg); break; } attack("P2", p2, p1); if (p1.isDead()) { msg = "P1 is dead"; Debug.Log(msg); break; } } Debug.Log("Rounds: " + rounds); }
public void Show(HeroBase _hero) { hero = _hero; heroName.text = hero.sds.name; cost.text = hero.sds.cost.ToString(); hp.text = hero.sds.hp.ToString(); power.text = hero.sds.power.ToString(); attack.text = hero.sds.attack.ToString(); shoot.text = hero.sds.shoot.ToString(); counter.text = hero.sds.counter.ToString(); defense.text = hero.sds.defense.ToString(); leader.text = hero.sds.leader.ToString(); comment.text = hero.sds.comment; if (!gameObject.activeSelf) { gameObject.SetActive(true); } }
public void equipReplaceItem(GameObject item) { HeroBase currentlySelectedHero = (HeroBase)heroMenu.currentlySlecetedShadow().GetComponent <ShadowScript>().shadowedScript; if (item != null) { foreach (GameObject charSlot in inventoryWindow.characterSlots) { if ((item.GetComponent <ItemBase>().currentItemType == charSlot.GetComponent <ItemSlotScript>().currentItemType) && charSlot.GetComponent <ItemSlotScript>().isSlotEmpty() && (compareItemToHeroClass(currentlySelectedHero, itemInTheSlot))) { charSlot.GetComponent <ItemSlotScript>().receiveItem(item); clearItemSlot(); return; } } // in case the previous loop fails to find empty slot foreach (GameObject charSlot in inventoryWindow.characterSlots) { if (item.GetComponent <ItemBase>().currentItemType == charSlot.GetComponent <ItemSlotScript>().currentItemType && compareItemToHeroClass(currentlySelectedHero, itemInTheSlot)) { GameObject otherSlotItem; otherSlotItem = charSlot.GetComponent <ItemSlotScript>().itemInTheSlot; charSlot.GetComponent <ItemSlotScript>().receiveItem(item); this.receiveItem(otherSlotItem); return; } } } }
public HeroBase Fight(HeroBase hero1, HeroBase hero2) { while (!hero1.IsDead || !hero2.IsDead) { hero2.Defence(hero1); if (hero2.IsDead) { break; } hero1.Defence(hero2); } if (hero1.IsDead) { hero2.GainExp(25); } else { hero1.GainExp(25); } hero1.GetToFullStats(); hero2.GetToFullStats(); return(hero1.IsDead ? hero2 : hero1); }
void OnTriggerEnter(Collider other) { HeroBase hero = other.GetComponent <HeroBase>(); if (hero != null && hero.team != rein.team) { rein.ChargeStick(hero); } }
void ShowTooltip(HeroBase target) { isShowingTooltip = true; m_ToolTip.transform.position = target.transform.position; m_ToolTip.GetComponentInChildren <TextMeshProUGUI>().text = target.UITooltip; m_ToolTip.SetActive(true); }
public Hero SpawnHero(int id, Vector3 pos) { HeroBase heroBase = Tools.Clone(m_HeroData.HeroDict[id]); Hero hero = ObjectManager.Instance.InstantiateObject(heroBase.Path).GetComponent <Hero>(); hero.Init(heroBase); hero.transform.position = pos; return(hero); }
void InitializeGame() { heroes = new HeroBase[heroes.Length]; for (int i = 0; i < heroes.Length; i++) { heroes[i] = new HeroBase(); } }
public void Hide() { hero = null; if (gameObject.activeSelf) { gameObject.SetActive(false); } }
public void OnTriggerExit(Collider other) { HeroBase hb = other.GetComponent <HeroBase>(); if (hb != null) { hb.uiStatus.HideRevive(); } }
protected override void DoEffect(HeroBase hero) { base.DoEffect(hero); Instantiate(vfx, hero.transform.position, Quaternion.identity); //Vector3 position = p.transform.position; //p.AttackOnce(position); //p.AddHp(add_hp); //obj = Instantiate(Resources.Load(vfx_name), position+new Vector3(0.0f, 0.5f, 0.0f), Quaternion.identity) as GameObject; }
private void Start() { gridmaster = (SuperGrids)FindObjectOfType(typeof(SuperGrids)); mat = GetComponent <Renderer>().material; heroTest = (HeroBase)FindObjectOfType(typeof(HeroBase)); mat.color = Color.clear; CheckSurroundings(); }
void OnHeroFrameClicked(HeroBase target) { if (selectionCoroutine != null) { StopCoroutine(selectionCoroutine); } selectionCoroutine = SelectionRoutine(target); StartCoroutine(selectionCoroutine); }
void Start() { unitBase = new HeroBase { unit = this, }; speed = unitBase.speed; visionRange = isFly ? 5 : 3; // PathfindOverBack = OverPath; }
protected override void DoEffect(HeroBase hero) { base.DoEffect(hero); //absorb hp int add_hp = (int)(hero.Att * 0.1f); hero.AddHp(add_hp); Instantiate(vfx, hero.transform.position, Quaternion.identity); }
public override void Attack(HeroBase monster) { unitBase.hp -= (monster.attack > unitBase.defend) ? monster.attack - unitBase.defend : 0; monster.hp -= (unitBase.attack > monster.defend) ? unitBase.attack - monster.defend : 0; Debug.Log("英雄所剩血量:" + unitBase.hp); Debug.Log("怪物所剩血量:" + monster.hp); if (monster.hp <= 0) { Grid.RemoveUnit(monster.unit); } }
public void OnTriggerEnter(Collider other) { HeroBase hb = other.GetComponent <HeroBase>(); if (hb != null) { if (hb.StatusCurrent == CharacterBase.CharacterStatus.Sick) { hb.uiStatus.ShowRevive(); } } }
public void Hide(HeroBase _hero) { if (hero == _hero) { hero = null; if (gameObject.activeSelf) { gameObject.SetActive(false); } } }
public void Start() { isCanSelect = false; isMonster = true; unitBase = new HeroBase { attack = 1, speed = 0, defend = 3, unit = this, }; }
public bool LoadConfig(string jsonStr) { heroConfigMap.Clear(); JsonData data = JsonMapper.ToObject(jsonStr); for (int i = 0, count = data.Count; i < count; i++) { HeroBase hero = JsonMapper.ToObject <HeroBase>(data[i].ToJson()); heroConfigMap[hero.getId()] = hero; } return(true); }
private void OnTriggerEnter(Collider other) { HeroBase hb = other.GetComponent <HeroBase>(); if (hb != null) { if (hb.HeroType == HeroBase.HeroTypes.Tree) { hb.SetSickness(CharacterBase.CharacterSickness.Water); AudioManager.instance.PlaySound(AudioManager.SoundEffects.Water); } } }
// returns true if item fits the given slot bool compareItemToHeroClass(HeroBase heroScript, GameObject item) { ItemBase itemScript = item.GetComponent <ItemBase>(); if ((heroScript.myClass == itemScript.primaryItemClass || heroScript.myClass == itemScript.secondaryItemClass) || (itemScript.primaryItemClass == heroClass.All && (heroScript.myClass != itemScript.primaryExceptItemClass && heroScript.myClass != itemScript.secondaryExceptItemClass))) { print("True"); return(true); } print("false"); return(false); }
void Start() { mousePosIsFinal = true; fpsController = GetComponentInChildren <RigidbodyFirstPersonController>(); fpsController.mouseLook.XSensitivity = 1; fpsController.mouseLook.YSensitivity = 1; hero = GetComponent <HeroBase>(); agent = GetComponent <NavMeshAgent>(); path = new NavMeshPath(); lastGoal = transform.position; agent.enabled = false; newEnemyTimer = newEnemyTime; }
protected override void DoEffect(HeroBase hero) { base.DoEffect(hero); Vector3 st_pos = hero.transform.position; //st_pos.y += 2; //Instantiate(Resources.Load("Skill_2"), st_pos, hero.transform.rotation); vfx = Instantiate(vfx, st_pos, Quaternion.identity) as GameObject; SkillEffect ball = Instantiate(se, st_pos, Quaternion.identity) as SkillEffect; ball.TriggerActive(st_pos, hero.transform.forward, move_speed, damage, vfx); }
public HeroBase Scout() { Collider[] hitColliders = Physics.OverlapSphere(this.transform.position, 130f, CaravanLM); List <HeroBase> heroes = new List <HeroBase>(); foreach (Collider c in hitColliders) { HeroBase hb = c.GetComponent <HeroBase>(); if (hb != null) { if (hb.HealthCurrent > 0f && hb.StatusCurrent != CharacterStatus.Sick) { heroes.Add(hb); } } } HeroBase target = null; switch (CurrentStrategy) { case AttackStrategy.Bloodthirst: //Lowest HP target = heroes.OrderBy(t => (t.HealthCurrent)) .FirstOrDefault(); break; case AttackStrategy.Glory: //Most HP target = heroes.OrderByDescending(t => (t.transform.GetComponent <HeroBase>().HealthCurrent)) .FirstOrDefault(); break; case AttackStrategy.HeroType: target = heroes.OrderBy(t => (t.transform.GetComponent <HeroBase>().HeroType == HeroThirst)).FirstOrDefault(); break; default: break; } if (target == null) { target = heroes.OrderBy(t => (t.transform.position - this.transform.position).sqrMagnitude) .FirstOrDefault(); } //if(target != null) print("Scount found:" + target.CharacterName); return(target); }
public void SelectGenesisFinal() { GameObject[] GOs = GameObject.FindGameObjectsWithTag("Caravan"); foreach (GameObject go in GOs) { HeroBase hb = go.GetComponent <HeroBase>(); if (hb.HeroType == HeroBase.HeroTypes.Tree) { SetSelectedUnit(go); cameraControl.followTransform = go.transform; //LeanTween.move(cam.gameObject, new Vector3(go.transform.position.x, cam.transform.position.y, go.transform.position.z), 0.5f).setEaseInOutQuad(); FirstStart = false; } } }
public void Init(HeroBase data) { m_Data = data; m_ExtraData = m_ExtraDataPool.Spawn(); m_SkillDict.Clear(); foreach (int id in m_Data.SkillList) { SkillBase skill = SkillManager.Instance.GetSkill(id); if (!m_SkillDict.ContainsKey(skill.SkillType)) { m_SkillDict.Add(skill.SkillType, new List <SkillBase>()); } m_SkillDict[skill.SkillType].Add(skill); } }