void Base(RigBoxCtl rbc) { float rate=weight/rbc.weight; Vector3 v3=(parent.localPosition-rbc.parent.localPosition); rbc.f.CombineF(-v3.normalized*f*10*rate); }
//攻击检 void OnTriggerEnter(Collider csi) { if (csi.tag == "RigBox" && this.tag == "AtkBox") { RigBoxCtl rbc = csi.GetComponent <RigBoxCtl>(); int id = rbc.parent.GetInstanceID(); if (id != root.GetInstanceID()) { CharaCtlFourFace emy = rbc.parent.GetComponent <CharaCtlFourFace>(); if (root != null) { CharaCtlFourFace chr = root.GetComponent <CharaCtlFourFace>(); if (chr != null) { chr.Atk(emy); emy.aim = chr; } } if (tagType == "Chara" && rbc.tagType == "Chara") { Base(rbc); } else if (tagType == "Arrow" && rbc.tagType == "Chara") { Base(rbc); parent.SendMessage("OnAtk", emy, SendMessageOptions.DontRequireReceiver); } } } }
void Base(RigBoxCtl rbc) { float rate = weight / rbc.weight; Vector3 v3 = (parent.localPosition - rbc.parent.localPosition); rbc.f.CombineF(-v3.normalized * f * 10 * rate); }
//基本形体碰撞 void OnTriggerStay(Collider csi) { int id = csi.GetInstanceID(); if (id != this.GetInstanceID()) { if (csi.tag == "RigBox" && this.tag == "RigBox") { RigBoxCtl dbc = csi.GetComponent <RigBoxCtl>(); float rate = weight / dbc.weight; Vector3 v3 = (transform.parent.localPosition - csi.transform.parent.localPosition); dbc.f.CombineF(-v3.normalized * (speed + 10f) * rate); } //Debug.Log(csi.name); } }