public void Attacked(AttackObj skill) { if (isAttackAble && !BPlayer.MainPlayer._isMove) { isAttackAble = false; GetComponent <BPlayer>()._isMoveAble = false; skill.col = new GameObject[1]; skill.col[0] = col; skill.EndCallBack = () => { StartCoroutine(Wait(() => { GetComponent <BPlayer>()._isMoveAble = true; isAttackAble = true; GetComponent <Animator>().SetBool("Attack", false); GetComponent <Animator>().SetFloat("Skill_id", 0); }, skill.EndTime - skill.StartTime + skill.AttackTime)); }; skill.HitCallBack = (hitObj, attackObj) => { Debug.Log("콜백 증가됨;;;;"); var Player = BPlayer.MainPlayer.GetComponent <NetworkObject>(); hitObj.gameObject.GetComponent <oCreature>().CurrentHP.Value -= skill.Damage + Player.Final_ATK; }; GetComponent <Animator>().SetBool("Attack", true); GetComponent <Animator>().SetFloat("Skill_id", skill.AniCode); StartCoroutine(Wait(() => { GetComponent <AttackerManager>().CallAttack(skill); }, skill.StartTime)); } }
private void checkEffect(AttackObj attacker) { Fx fx; if (attacker.particles == null) { return; } if (attacker.particles.gameObject.name == "hypnotized") { fx = Fx.Distracted; } else if (attacker.particles.gameObject.name == "confused") { fx = Fx.Confused; } else if (attacker.particles.gameObject.name == "love") { fx = Fx.Love; } else if (attacker.particles.gameObject.name == "bats") { fx = Fx.Scared; } else { return; } if (sideEffect != null && sideEffect.effect == fx) { return; } healthBar.setSideEffect(fx, this); sideEffect = new SideEffect(fx, attacker.owner.cat.getCatAsset().secondaryType); }
public void cerraPaneles() { GeneralInfoObj.SetActive(false); CrewildInfoObj.SetActive(false); AttackObj.SetActive(false); PosturesObj.SetActive(false); breedingObj.SetActive(false); }
public void hitByObj(float damage, AttackObj attacker) { checkEffect(attacker); if (damage > 0) { owner.getCameraShake().Shake(); } takeDamage(damage); }
//object pooling public void getAttackObj(ExploreCat enemyCat, float damage) { if (attackObjs.Count == 0) { CreateAttackObject(enemyCat, damage); return; } cAttack = attackObjs.Dequeue(); cAttack.setOnHit(true); cAttack.setDamage(damage); }
private void ToAvoidance() { for (int i = 0; i < stageMng.attacks.Count; i++) { var attackPredictPos = (stageMng.attacks[i].Direction * dangerSearchDis) + stageMng.attacks[i].transform.position; var attackPredictDis = Vector3.Distance(transform.position, attackPredictPos); if (attackPredictDis <= 1 && stageMng.attacks[i].Master != this) { targetAttackObj = stageMng.attacks[i]; break; } } }
internal commandWithTime.ReturningOjb randomWhenConfused(RoleInGame player, RoleInGame boss, Car car, SetAttack sa, ref List <string> notifyMsg, out MileResultReason Mrr) { AttackObj ao = new AttackObj(sa, (int startT, Car car, SetAttack sa, int goMile, Node goPath, commandWithTime.ReturningOjb ro) => { //this.SetAttackArrivalThread() List <string> notifyMsg = new List <string>(); car.setState(player, ref notifyMsg, CarState.working); this.sendMsg(notifyMsg); this.SetAttackArrivalThread(startT, 0, player, car, sa, goMile, goPath, ro); } ); return(this.randomWhenConfused(player, boss, car, ao, ref notifyMsg, out Mrr)); }
private void CreateAttackObject(ExploreCat enemyCat, float damage) { cAttack = Instantiate(Resources.Load <GameObject>("miscPrefabs/" + cat.getCatAsset().attackType.ToString())).GetComponent <AttackObj>(); Sprite secondarySprite = Resources.Load <Sprite>("fightUI/" + this.cat.getCatAsset().secondaryType.ToString()); if (cat.getCatAsset().attackType == AttackType.Melee) { ((Melee)cAttack).Init(this); ((Melee)cAttack).getSprite().sprite = secondarySprite; } else if (cat.getCatAsset().attackType == AttackType.Ranged) { cAttack.GetComponent <SpriteRenderer>().sprite = secondarySprite; ((Projectile)cAttack).Init(this, this.realizedStats.projectileSpeed, cat.getCatAsset().secondaryType); } cAttack.setDamage(damage); }
public void CollectBlockCancel() { if (status != Status.Damage) { status = Status.Normal; } collectBlockCount = 0; if (targetBlock != null) { targetBlock.MarkSwitch(false); targetBlock = null; } if (myAttack != null) { Destroy(myAttack.gameObject); myAttack = null; } }
public void CallAttack(AttackObj obj) { var _obj = obj; _obj.TimeT = 0f; objs[_obj] = () => { _obj.TimeT += Time.deltaTime; if (_obj.TimeT >= _obj.AttackTime) { RemoveManager.Enqueue(_obj); _obj.setCol(false); _obj.EndCallBack(); } }; _obj.setCol(true); _obj.AttackStart(); }
public void BlockAttack() { if (myAttack.CollectNum <= 0) { CollectBlockCancel(); } else { if (targetBlock != null) { targetBlock.MarkSwitch(false); targetBlock = null; } realCoolDownTime = coolDownTime + (myAttack.CollectNum - 1) / 2f; status = Status.Attack; collectBlockCount = 0; var direction = Vector3.Scale((hand.transform.position - transform.position), new Vector3(1, 0, 1)); myAttack.Attack(direction.normalized, attackSpeed, attackSaveTime); myAttack = null; } }
public void AttackVigilanceCancel() { if (ai == AIStatus.Avoidance) { if (targetAttackObj.Master.IsDeath == false) { var dis = Vector3.Distance(transform.position, targetAttackObj.Master.transform.position); if (dis <= enemySearchDis * 2) { targetEnemy = targetAttackObj.Master; ai = AIStatus.Chase; } else { ToSearch(); } } else { ToSearch(); } targetAttackObj = null; } }
void Accion() { if (ActivaNavegacion == false) { SelectPos(); selectCrewild(); } if (ActivaNavegacion == true && Input.GetKeyDown(KeyCode.Space) || ActivaNavegacion == true && Input.GetKeyDown(KeyCode.C) ) { Invoke("retroceder", 0.2f); } if (posPanel == 1) { TipePanel.text = "Info"; ValidatorBool[0] = true; GeneralInfoObj.SetActive(true); botones.enabled = false; } else if (posPanel == 2) { TipePanel.text = "Estadisticas"; ValidatorBool[1] = true; CrewildInfoObj.SetActive(true); botones.enabled = false; } else if (posPanel == 3) { TipePanel.text = "Ataques"; ValidatorBool[2] = true; AttackObj.SetActive(true); botones.enabled = true; if (Input.GetKeyDown(KeyCode.Space) && ActivaNavegacion == false) { ActivaNavegacion = true; } else if (ActivaNavegacion == true) { NavAtaques(); } } else if (posPanel == 4) { TipePanel.text = "Posturas"; ValidatorBool[3] = true; PosturesObj.SetActive(true); botones.enabled = false; } else if (posPanel == 5) { TipePanel.text = "Crianza"; ValidatorBool[4] = true; breedingObj.SetActive(true); botones.enabled = true; /* if (Input.GetKeyDown(KeyCode.Space) && ActivaNavegacion == false) * ActivaNavegacion = true; * else if (ActivaNavegacion == true) * NavAtaques();*/ } //----------------------------------------------------------- if (posPanel != 1 && ValidatorBool[0] == true) { GeneralInfoObj.SetActive(false); ValidatorBool[0] = false; } else if (posPanel != 2 && ValidatorBool[1] == true) { CrewildInfoObj.SetActive(false); ValidatorBool[1] = false; } else if (posPanel != 3 && ValidatorBool[2] == true) { AttackObj.SetActive(false); ValidatorBool[2] = false; } else if (posPanel != 4 && ValidatorBool[3] == true) { PosturesObj.SetActive(false); ValidatorBool[3] = false; } else if (posPanel != 5 && ValidatorBool[4] == true) { breedingObj.SetActive(false); ValidatorBool[4] = false; } }
void Secuencias(CrewildBase crewild) { if (ActivaNavegacion == true && Input.GetKeyDown(KeyCode.Space) || ActivaNavegacion == true && Input.GetKeyDown(KeyCode.C) ) { Invoke("retroceder", 0.2f); } if (cierraPaneles == true) { cerraPaneles(); cierraPaneles = false; } if (posPanel == 1) { TipePanel.text = "Info"; GeneralInfoObj.SetActive(true); botones.enabled = false; } else if (posPanel == 2) { TipePanel.text = "Estadisticas"; CrewildInfoObj.SetActive(true); botones.enabled = false; } else if (posPanel == 3) { TipePanel.text = "Ataques"; AttackObj.SetActive(true); botones.enabled = true; if (Input.GetKeyDown(KeyCode.Space) && ActivaNavegacion == false) { ActivaNavegacion = true; } else if (ActivaNavegacion == true) { NavAtaques(crewild); } } else if (posPanel == 4) { TipePanel.text = "Posturas"; PosturesObj.SetActive(true); botones.enabled = false; } else if (posPanel == 5) { TipePanel.text = "Crianza"; breedingObj.SetActive(true); botones.enabled = false; /* if (Input.GetKeyDown(KeyCode.Space) && ActivaNavegacion == false) * ActivaNavegacion = true; * else if (ActivaNavegacion == true) * NavAtaques(); */ } }
public void CollectBlock(float period) { if (status == Status.Attack || status == Status.Damage) { changeBlockCount = 0; return; } if (MyBlockNum <= 0) { changeBlockCount = 0; status = Status.Normal; return; } if (status != Status.Collect) { collectBlockCount = 0; status = Status.Collect; var stageMng = GameObject.Find("StageMng").GetComponent <StageMng>(); targetBlock = FurthestBlock(stageMng); targetBlock.MarkSwitch(true); var efe = Instantiate(ResourcesMng.ResourcesLoad("CubeEffect"), targetBlock.transform.position, Quaternion.identity); efe.GetComponent <BlockEffect>().Init(this, color); var attackObj = new GameObject(); attackObj.AddComponent <AttackObj>(); myAttack = attackObj.GetComponent <AttackObj>(); myAttack.Init(this); } else { if (collectBlockCount < period) { collectBlockCount += Time.deltaTime; } else { if (myAttack.CollectNum < maxCollectNum) { if (targetBlock.isStepOn == false && targetBlock.whos == this) { myAttack.BlockRegister(targetBlock); targetBlock.MarkSwitch(false); MyBlockNum--; } var stageMng = GameObject.Find("StageMng").GetComponent <StageMng>(); targetBlock = FurthestBlock(stageMng); targetBlock.MarkSwitch(true); var efe = Instantiate(ResourcesMng.ResourcesLoad("CubeEffect"), targetBlock.transform.position, Quaternion.identity); efe.GetComponent <BlockEffect>().Init(this, color); } else { if (targetBlock != null) { targetBlock.MarkSwitch(false); targetBlock = null; } } collectBlockCount = 0; } } }
public void AttackObjRegister(AttackObj attack) { attacks.Add(attack); }
public void AttackObjDelate(AttackObj attack) { attack.VigilanceCancel(); attacks.Remove(attack); Destroy(attack.gameObject); }
// Use this for initialization void Start() { LibreriaS = GameObject.Find("Game Manager/").GetComponent <libreriaDeScrips>(); CrewillInstancia = new CrewildBase[6]; int Auxlevel = 10; CrewillInstancia[0] = new Beslin(Auxlevel); CrewillInstancia[2] = new crear_Crewild_Grismon_Insecto_Energia(Auxlevel); /* CrewillInstancia[3] = new Kanget(Auxlevel); * CrewillInstancia[4] = new Beslin(Auxlevel); * CrewillInstancia[5] = new Retolizar(Auxlevel);*/ // barras de estaminas // CrewillInstancia[0].EstadosCrewild = EstadosEnum.Paralize; // CrewillInstancia[1].EstadosCrewild = EstadosEnum.poison; // CrewillInstancia[0].EstadosCrewild = EstadosEnum.Paralize; // CrewillInstancia[0].Hp = CrewillInstancia[0].hpTotal / 2; BarraHp = GameObject.Find("informacion/estadisticas/NameBox/Hp").GetComponent <Scrollbar>(); HpInfo = GameObject.Find("informacion/estadisticas/NameBox/Hp/text").GetComponent <Text>(); BarraExp = GameObject.Find("informacion/estadisticas/NameBox/Exp").GetComponent <Scrollbar>(); SigNvl = GameObject.Find("informacion/estadisticas/NameBox/Exp/sig Nvl").GetComponent <Text>(); GeneralInfoObj = GameObject.Find("informacion/estadisticas/GeneralInfo"); CrewildInfoObj = GameObject.Find("informacion/estadisticas/CrewildInfo"); AttackObj = GameObject.Find("informacion/estadisticas/Attack"); PosturesObj = GameObject.Find("informacion/estadisticas/Postures"); breedingObj = GameObject.Find("informacion/estadisticas/Breeding"); //-------- panles Statick info ----------- NameCrewild = GameObject.Find("informacion/estadisticas/NameBox/NameCrewild").GetComponent <Text>(); Nivel = GameObject.Find("informacion/estadisticas/NameBox/NivelCriatura").GetComponent <Text>(); //-------- panles general info ----------- Crewild = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Crewild").GetComponent <Text>(); Nombre = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Nombre").GetComponent <Text>(); Tipo = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Tipo").GetComponent <Text>(); Estado = GameObject.Find("informacion/estadisticas/GeneralInfo/estadosEfecto/Estados/Estado/Texto").GetComponent <Text>(); estadoImag = GameObject.Find("informacion/estadisticas/GeneralInfo/estadosEfecto/Estados/Estado").GetComponent <Image>(); Efecto = GameObject.Find("informacion/estadisticas/GeneralInfo/estadosEfecto/Efectos").GetComponent <Text>(); Descripcion = GameObject.Find("informacion/estadisticas/GeneralInfo/estadosEfecto/Descripcion").GetComponent <Text>(); Tipos[0] = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Tipos 1/Texto").GetComponent <Text>(); Tipos[1] = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Tipos 2/Texto").GetComponent <Text>(); imagesTipos[0] = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Tipos 1").GetComponent <Image>(); imagesTipos[1] = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Tipos 2").GetComponent <Image>(); RectfTipo2 = GameObject.Find("informacion/estadisticas/GeneralInfo/nombreDatos/Tipos 2").GetComponent <RectTransform>(); //-------- panel CrewildInfo info ----------- ataque = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/Ataque").GetComponent <Text>(); Defence = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/Defensa").GetComponent <Text>(); Evation = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/Velocidad").GetComponent <Text>(); Speed = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/Evacion").GetComponent <Text>(); AtaClass = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/AtaClass").GetComponent <Text>(); DefClass = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/DefClass").GetComponent <Text>(); Resistence = GameObject.Find("informacion/estadisticas/CrewildInfo/estadisticas/Resistence").GetComponent <Text>(); //---------- panel Attacks info --------------- for (int i = 0; i < 4; i++) { AtaqueText[i] = GameObject.Find("informacion/estadisticas/Attack/Movimientos/Attack" + (i + 1)).GetComponent <Text>(); } DescripcionAtaque = GameObject.Find("informacion/estadisticas/Attack/Descripcion/text").GetComponent <Text>(); //---------- panel Postures info --------------- Postures1 = GameObject.Find("informacion/estadisticas/Postures/movimientos/Postura1").GetComponent <Text>(); Postures2 = GameObject.Find("informacion/estadisticas/Postures/movimientos/Postura2").GetComponent <Text>(); Postures3 = GameObject.Find("informacion/estadisticas/Postures/movimientos/Postura3").GetComponent <Text>(); Postures4 = GameObject.Find("informacion/estadisticas/Postures/movimientos/Postura4").GetComponent <Text>(); //---------- panel crianza info --------------- HambreBarra = GameObject.Find("informacion/estadisticas/Breeding/estados/Hambre").GetComponent <Scrollbar>(); SueñoBarra = GameObject.Find("informacion/estadisticas/Breeding/estados/Sueño").GetComponent <Scrollbar>(); EmpatiaBarra = GameObject.Find("informacion/estadisticas/Breeding/estados/Empatia").GetComponent <Scrollbar>(); CorduraBarra = GameObject.Find("informacion/estadisticas/Breeding/estados/Cordura").GetComponent <Scrollbar>(); HambreText = GameObject.Find("informacion/estadisticas/Breeding/estados/Hambre/text").GetComponent <Text>(); SueñoText = GameObject.Find("informacion/estadisticas/Breeding/estados/Sueño/text").GetComponent <Text>(); EmpatiaText = GameObject.Find("informacion/estadisticas/Breeding/estados/Empatia/text").GetComponent <Text>(); CorduraText = GameObject.Find("informacion/estadisticas/Breeding/estados/Cordura/text").GetComponent <Text>(); //---------- panel breeding info --------------- TipePanel = GameObject.Find("informacion/estadisticas/panelType/textMenus").GetComponent <Text>(); //foto de criatura imagenCriatura = GameObject.Find("informacion/estadisticas/foto criatura/imagenCrewild").GetComponent <Image>(); //botones botones = GameObject.Find("informacion/Boton").GetComponent <Image>(); botones.enabled = false; RectfPanelAtaques = GameObject.Find("informacion/Selector").GetComponent <RectTransform>(); RectfPanelAtaques.GetComponent <Image>().enabled = false; // global text GeneralInfoObj.SetActive(true); CrewildInfoObj.SetActive(false); AttackObj.SetActive(false); PosturesObj.SetActive(false); breedingObj.SetActive(false); if (CargueDatos == false) { Invoke("InvokeCargar", 0.1f); CargueDatos = true; } EfectoFueraDeBatalla.verificador(); }