//场景初始化调用,或者爆出物品,待物品落地时调用 public void OnStart(LevelScriptBase script = null) { initializeY = transform.position.y; if (curve == null) { Keyframe[] ks = new Keyframe[2]; ks[0] = new Keyframe(0, -1); ks[1] = new Keyframe(1, 1); curve = new AnimationCurve(ks); //curve. } curve.postWrapMode = WrapMode.PingPong; curve.preWrapMode = WrapMode.PingPong; //自转+高度转 if (!property.names.ContainsKey("machine") && gameObject.activeSelf && !billBoard) { StartCoroutine(yMove()); } if (script != null) { MethodOnAttack = script.GetType().GetMethod(gameObject.name + "_OnAttack"); MethodOnIdle = script.GetType().GetMethod(gameObject.name + "_OnIdle"); } if (MethodOnAttack != null || OnAttackCallBack != null) { RefreshCollision(); } }
//场景初始化调用,或者爆出物品,待物品落地时调用 public void OnStart(LevelScriptBase script = null) { initializeY = transform.position.y; //自转+高度转 if (!property.names.ContainsKey("machine") && !billBoard) { if (curve == null) { Keyframe[] ks = new Keyframe[2]; ks[0] = new Keyframe(0, -1); ks[1] = new Keyframe(1, 1); curve = new AnimationCurve(ks); } curve.postWrapMode = WrapMode.PingPong; curve.preWrapMode = WrapMode.PingPong; animate = true; } if (script != null) { MethodOnAttack = script.GetType().GetMethod(gameObject.name + "_OnAttack"); MethodOnIdle = script.GetType().GetMethod(gameObject.name + "_OnIdle"); OnTouch = Main.Ins.CombatData.GScriptType.GetMethod(name + "_OnTouch", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (OnTouch == null) { System.Type typeParent = Main.Ins.CombatData.GScriptType.BaseType; while (typeParent != null && OnTouch == null) { OnTouch = typeParent.GetMethod(name + "_OnTouch", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); typeParent = typeParent.BaseType; } } OnPickUp = Main.Ins.CombatData.GScriptType.GetMethod(name + "_OnPickUp", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); if (OnPickUp == null) { System.Type typeParent = Main.Ins.CombatData.GScriptType.BaseType; while (typeParent != null && OnPickUp == null) { OnPickUp = typeParent.GetMethod(name + "_OnPickUp", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); typeParent = typeParent.BaseType; } } } if (MethodOnAttack != null || OnAttackCallBack != null) { RefreshCollision(); } }