public void Arrowfly(GameObject arrow, Vector3 pos) { arrow.transform.parent = null; CCArrowAction action = CCArrowAction.GetSSAction(); arrow.transform.position = pos; this.addAction(arrow, action, this); arrow.GetComponent <Arrow>().action = action; wind = Random.Range(-5f, 5f); }
void OnTriggerEnter(Collider arrow) { if (arrow.gameObject.tag == "Arrow") { if (!arrow.gameObject.GetComponent <Arrow>().hit) { arrow.gameObject.GetComponent <Arrow>().hit = true; target_score = (name[0] - '0');//通过名称控制分数 controller.score += target_score; } arrowshoot = (CCArrowAction)arrow.gameObject.GetComponent <Arrow>().action; arrow.gameObject.GetComponent <Rigidbody>().velocity = Vector3.zero;//箭插入箭靶效果 arrowshoot.Destory(); } }
public static CCArrowAction GetSSAction() { CCArrowAction action = ScriptableObject.CreateInstance <CCArrowAction>(); return(action); }