public void Drop() { string json = PlayerPrefs.GetString("RoleDate"); RoleDate jd = JsonMapper.ToObject <RoleDate>(json); for (int i = 0; i < jd.Items.Count; i++) { if (jd.Items[i].ItemID == _Date.ItemID) { jd.Items[i].Count -= 1; if (jd.Items[i].Count == 0) { jd.Items.RemoveAt(i); Destroy(gameObject); UIPackageController.isDisplay = false; } break; } } string newJson = JsonMapper.ToJson(jd); PlayerPrefs.SetString("RoleDate", newJson); GameObject.Find("UI/Canvas/Package").GetComponent <UIPackageController>().LoadItemList(); GameObject.Find("UI/Canvas/Package").GetComponent <UIPackageController>().LoadCharacterItem(); }
//初始化 血条的 长度 数据匹配到链接的角色 public virtual void GetGameObj(RoleDate _roleDate = null) { if (gameObj != null) { //gameObj = GlobalTools.FindObjByName("player"); //print(" gameObjName "+gameObj.name); if (_roleDate != null) { roleDate = _roleDate; //print(" @@ _roleDate "+ _roleDate.live); } else { roleDate = gameObj.GetComponent <RoleDate>(); } //print("roleDate-------------> "+ roleDate); _maxLive = roleDate.maxLive; print(gameObj.name + " 当前xuel " + roleDate.live + " max " + roleDate.maxLive); //print("111111111 当前 血量是多少 " + _cLive + " 传进来的 当前血量roleDate.live " + roleDate.live); //_cLive = _cLive > roleDate.maxLive ? roleDate.maxLive : _cLive; _cLive = roleDate.live; //print("最大血上线xue change! roleDate.maxLive " + roleDate.maxLive + " _maxLive " + _maxLive + " 传进来数据 " + e.eventParams + " ---clive " + _cLive + " ----roledateLive " + roleDate.live); print(" 当前 血量是多少 " + _cLive + " 传进来的 当前血量roleDate.live " + roleDate.live); //_cLive = roleDate.live; roleDate.live = _cLive; print("roledetelive " + roleDate.live); GetXueNum(0); //isChage = true; } }
void Start() { if (_roleDate == null) { _roleDate = GetComponent <RoleDate>(); } }
public static RoleDate ReadRoleDate() { string json = PlayerPrefs.GetString(keyName); Debug.Log("Read Player Info:" + json); RoleDate jd = JsonMapper.ToObject <RoleDate>(json); return(jd); }
void Start() { if (YanChen) { YanChen.Stop(); } _gameBody = GetComponent <EnemyGameBody>(); _roleDate = GetComponent <RoleDate>(); }
// Start is called before the first frame update void Start() { _gameBody = GetComponent <GameBody>(); _roledate = GetComponent <RoleDate>(); _aiAirBase = GetComponent <AIAirBase>(); if (!_db) { _db = _gameBody.GetDB(); } }
public void LoadItemList() { Date = DynamicRoleDateModel.ReadRoleDate(); List <ItemCompleteDate> complete = StaticItemDateModel.ReadItemCompleteDate(Date.Items); CompleteDate = complete; if (complete.Count > 0) { ListView.DisPlay(complete); } }
//初始化 血条的 长度 数据匹配到链接的角色 public void GetGameObj() { if (gameObj != null) { roleDate = gameObj.GetComponent <RoleDate>(); _maxLive = roleDate.maxLive; roleDate.live = roleDate.live > roleDate.maxLive ? roleDate.maxLive : roleDate.live; _cLive = roleDate.live; GetXueNum(0); } }
//初始化 血条的 长度之类的 void GetGameObj() { if (gameObj != null) { roleDate = gameObj.GetComponent <RoleDate>(); _maxLan = roleDate.maxLan; roleDate.lan = roleDate.lan > roleDate.maxLan ? roleDate.maxLan : roleDate.lan; _cLan = roleDate.lan; GetXueNum(0); //isChage = true; } }
// Start is called before the first frame update void Start() { _gameBody = GetComponent <GameBody>(); _roleDate = GetComponent <RoleDate>(); _gameBody.GetDB().AddDBEventListener(DragonBones.EventObject.FRAME_EVENT, this.ShowACTX); ObjectEventDispatcher.dispatcher.addEventListener(EventTypeName.ZD_SKILL_SHOW, ZDSkillShow); //ObjectEventDispatcher.dispatcher.addEventListener(EventTypeName.ZD_SKILL_OVER, ZDSkillOver); ObjectEventDispatcher.dispatcher.addEventListener(EventTypeName.ZD_SKILL_OVER_ALL, ZDSkillOverAll); //print(" zd ********************** 正厅了 "); _yuanshiOverDelayTimes = OverDelayTimes; _AtkDistances = AtkDistances; TheStart(); }
// Use this for initialization protected void Start() { //Tools.timeData(); playerRigidbody2D = GetComponent <Rigidbody2D>(); DBBody = GetComponentInChildren <UnityArmatureComponent>(); //DBBody.AddEventListener(DragonBones.FrameEvent.MOVEMENT_FRAME_EVENT, this.onMOVEMENTBoneEvent, this); DBBody.AddDBEventListener(DragonBones.EventObject.FRAME_EVENT, this.ShowACTX); DBBody.AddDBEventListener(DragonBones.EventObject.SOUND_EVENT, this.ShowACTX); roleDate = GetComponent <RoleDate>(); //DBBody.AddDBEventListener(EventObject.FRAME_EVENT, this.test); DBBody.AddDBEventListener("atks", this.Test); bodyScale = new Vector3(1, 1, 1); vOAtk = GetComponent <VOAtk>(); this.transform.localScale = bodyScale; }
public void GetBeHit(JN_Date jn_date, float sx) { //print("被击中 !! "+this.transform.name+" 攻击力 "+ jn_date.atkPower+" 我的防御力 "+this.GetComponent<RoleDate>().def); gameBody = GetComponent <GameBody>(); roleDate = GetComponent <RoleDate>(); if (roleDate.isDie) { return; } float addxue = jn_date.atkPower - this.GetComponent <RoleDate>().def; addxue = addxue > 0 ? addxue : 1; roleDate.live -= addxue; if (roleDate.live < 0) { roleDate.live = 0; } //print("live "+ roleDate.live); if (!roleDate.isCanBeHit) { return; } if (gameBody != null) { //判断是否破防 D 代办事项 if (jn_date.atkPower - roleDate.yingzhi > 0) { } gameBody.HasBeHit(); } //判断是否在躲避阶段 无法被攻击 //判断击中特效播放位置 //击退 判断方向 float _psScaleX = sx; //判断是否在空中 //挨打动作 判断是否破硬直 //判断是否生命被打空 Bloods(_psScaleX); }
public override void GetGameObj(RoleDate _roleDate = null) { if (gameObj != null) { //print("gameObj--------------> " + gameObj); roleDate = gameObj.GetComponent <RoleDate>(); //print("roleDate-------------> "+ roleDate); _maxLive = roleDate.maxLan; roleDate.lan = roleDate.lan > roleDate.lan ? roleDate.maxLan : roleDate.lan; _cLive = roleDate.lan; GetXueNum(0); //isChage = true; SetLanText(roleDate.maxLan, roleDate.lan); //print("蓝 "+roleDate.maxLan+" clan "+roleDate.lan); } }
public void ScreenChangeDateRecord() { if (_player == null) { _player = GlobalTools.FindObjByName(GlobalTag.PlayerObj); if (_player == null) { _player = GlobalTools.FindObjByName(GlobalTag.PlayerJijiaObj); } } RoleDate _roleDate = _player.GetComponent <RoleDate>(); screenChangeDate = "cLive=" + _roleDate.live + "," + "cLan=" + _roleDate.lan; print(" 角色转场前 存储的 角色状态信息 》》》》》》 " + screenChangeDate); //Time.timeScale = 0; }
protected override void OtherOnEnable() { if (!_roledate) { _roledate = GetComponent <RoleDate>(); } _roledate.live = 1000; if (!FeibiaoXuanzhuan.isPlaying) { FeibiaoXuanzhuan.Play(); } if (GlobalTools.GetRandomNum() > 50) { FeibiaoDiu1.Play(); } else { FeibiaoDiu2.Play(); } }
void OnTriggerEnter2D(Collider2D Coll) { gameBody = Coll.GetComponent <GameBody>(); roleDate = Coll.GetComponent <RoleDate>(); _rigidbody2D = Coll.GetComponent <Rigidbody2D>(); //atkObj = txObj.GetComponent<JN_base>().atkObj; //print(atkObj.name); print(" ---coll name " + Coll.name + " roledate " + roleDate); if (roleDate && !IsCanHitBoss && roleDate.enemyType == "boss") { return; } JN_Date jn_date = GetComponent <JN_Date>(); if (roleDate != null && roleDate.team != jn_date.team) { //print("击中的2Dbox "+Coll.GetComponent<BoxCollider2D>().transform.position); if (roleDate.isDie) { return; } //if (!roleDate.isCanBeHit) return; //取到施展攻击角色的方向 //float _roleScaleX = -atkObj.transform.localScale.x; if (IsCanBeDodge) { //print("roleDate " + roleDate); //print(" isCanbeihit " + roleDate.isCanBeHit); if (!roleDate.isCanBeHit) { return; } } //这个已经不需要了 //if (Coll.GetComponent<BeHit>()) Coll.GetComponent<BeHit>().GetBeHit(jn_date, _roleScaleX); //print(" 这里是否进来 " + Coll.transform.position.x + " ------- " + this.transform.parent.transform.transform); if (this.transform.parent) { atkScaleX = Coll.transform.position.x < this.transform.parent.transform.position.x ? -1 : 1; } GetBeHit(jn_date, atkScaleX); //力作用 这个可以防止 推力重叠 导致任务飞出去 Vector3 tempV3 = _rigidbody2D.velocity; _rigidbody2D.velocity = new Vector3(0, tempV3.y, tempV3.z); if (jn_date != null && gameBody != null) { gameBody.HasBeHit(); if (this.transform.parent == null) { return; } if (Coll.transform.position.x > this.transform.parent.transform.position.x) { //Coll.GetComponent<Rigidbody2D>().AddForce(new Vector2(400 , 0)); Coll.GetComponent <GameBody>().GetZongTuili(new Vector2(400, 0)); } else { //Coll.GetComponent<Rigidbody2D>().AddForce(new Vector2(-400 , 0)); Coll.GetComponent <GameBody>().GetZongTuili(new Vector2(-400, 0)); } } //毒伤害 if (jn_date.DuChixuShanghai != 0) { //print(beHitObj.name + " --beihitteam " + BeHitRoleDate.team + " jnteam " + jn_date.team + " atkObjname " + atkObj.name); if (gameBody != null && roleDate.team != jn_date.team) { gameBody.GetComponent <ChiXuShangHai>().InDu(jn_date.DuChixuShanghai, jn_date.DuChixuShanghaiTime); } } if (jn_date.HuoChixuShanghai != 0) { if (gameBody != null && roleDate.team != jn_date.team) { gameBody.GetComponent <ChiXuShangHai>().InHuo(jn_date.HuoChixuShanghai, jn_date.HuoChixuShanghaiTime); } } } }
protected virtual void LiveChange(UEvent e) { if (gameObj && gameObj.tag != GlobalTag.Player) { return; } if (gameObj == null) { gameObj = GlobalTools.FindObjByName("player"); //print(" gameObj "+gameObj.name); //GetGameObj(); if (gameObj == null) { gameObj = GlobalTools.FindObjByName("player_jijia"); } } roleDate = gameObj.GetComponent <RoleDate>(); //print("XT gameObj> " + gameObj); bool isHZChange = false; float NewMaxLive = _maxLive; if (gameObj != null) { print(" name " + gameObj.name); print("最大血上线xue change! roleDate.maxLive " + roleDate.maxLive + " _maxLive " + _maxLive + " 传进来数据 " + e.eventParams + " ---_clive " + _cLive + " ----roledateLive " + roleDate.live); //_cLive = int.Parse(e.eventParams.ToString()); print(" 传进来的 clive " + e.eventParams.ToString()); string liveStr = e.eventParams.ToString(); _cLive = roleDate.live; if (liveStr.Split('_').Length >= 2) { NewMaxLive = float.Parse(liveStr.Split('_')[0]); isHZChange = true; } } roleDate.live = _cLive; print("2222222roledetelive " + roleDate.live); if (isHZChange) { GlobalSetDate.instance.ScreenChangeDateRecord(); } GlobalSetDate.instance.GetScreenChangeDate(); if (gameObj == null) { return; } if (gameObj.tag == GlobalTag.Player && roleDate) { AddMaxLiveBar(NewMaxLive - _maxLive); //print(" ???@roledate "+roleDate.live); GetGameObj(roleDate); } //print("333333333333333roledetelive " + roleDate.live); }
// Start is called before the first frame update void Start() { _roleDate = GetComponent <RoleDate>(); }
protected override void TheStart() { rb2d = GetComponent <Rigidbody2D>(); _roledate = GetComponent <RoleDate>(); }
void Start() { _roleDate = GetComponent <RoleDate>(); _gameBody = GetComponent <GameBody>(); }
// Start is called before the first frame update void Start() { _airGameBody = GetComponent <AirGameBody>(); _roleDate = GetComponent <RoleDate>(); _aiAirRunNear = GetComponent <AIAirRunNear>(); }
void OnTriggerEnter2D(Collider2D Coll) { gameBody = Coll.GetComponent <GameBody>(); roleDate = Coll.GetComponent <RoleDate>(); _rigidbody2D = Coll.GetComponent <Rigidbody2D>(); var txObj = this.transform.parent; atkObj = txObj.GetComponent <JN_base>().atkObj; JN_Date jn_date = txObj.GetComponent <JN_Date>(); if (roleDate != null && roleDate.team != jn_date.team) { //print("击中的2Dbox "+Coll.GetComponent<BoxCollider2D>().transform.position); if (roleDate.isDie) { return; } if (!roleDate.isCanBeHit) { return; } //取到施展攻击角色的方向 float _roleScaleX = -atkObj.transform.localScale.x; //这个已经不需要了 //if (Coll.GetComponent<BeHit>()) Coll.GetComponent<BeHit>().GetBeHit(jn_date, _roleScaleX); GetBeHit(jn_date, _roleScaleX); //力作用 这个可以防止 推力重叠 导致任务飞出去 Vector3 tempV3 = _rigidbody2D.velocity; _rigidbody2D.velocity = new Vector3(0, tempV3.y, tempV3.z); if (jn_date != null && gameBody != null) { //判断是否破防 D 代办事项 if (jn_date.atkPower - roleDate.yingzhi > roleDate.yingzhi * 0.5) { gameBody.HasBeHit(); //Coll.GetComponent<Rigidbody2D>().AddForce(new Vector2(400 * _roleScaleX, 0)); gameBody.GetZongTuili(new Vector2(400 * _roleScaleX, 0)); } else if (jn_date.atkPower - roleDate.yingzhi > 0) { gameBody.HasBeHit(); //Coll.GetComponent<Rigidbody2D>().AddForce(new Vector2(300 * _roleScaleX, 0)); gameBody.GetZongTuili(new Vector2(300 * _roleScaleX, 0)); if (atkObj && jn_date._type == "1") { atkObjV3Zero(); //atkObj.GetComponent<Rigidbody2D>().AddForce(new Vector2(-300 * _roleScaleX, 0)); atkObj.GetComponent <GameBody>().GetZongTuili(new Vector2(-300 * _roleScaleX, 0)); } } else { if (atkObj && jn_date._type == "1") { atkObjV3Zero(); //atkObj.GetComponent<Rigidbody2D>().AddForce(new Vector2(-500 * _roleScaleX, 0)); atkObj.GetComponent <GameBody>().GetZongTuili(new Vector2(-500 * _roleScaleX, 0)); } } } //判断作用力与反作用力 硬直判断 // //Coll.GetComponent<Rigidbody2D>().AddForce(new Vector2(0, 300)); //如果是碰撞就消失 调用消失方法 if (jn_date != null && jn_date._type == "3") { //if (gameObject) ObjectPools.GetInstance().DestoryObject2(gameObject); txObj.GetComponent <JN_base>().DisObj(); } } }