internal void AddColliderTriggers()
        {
            //KKCallBack kkCall = gameObject.GetComponentInChildren<KKCallBack>(true);
            Log.Normal("AniMateOnTrigger: Adding KKCallBack to GameObject");
            KKCallBack kkCall = gameObject.AddComponent <KKCallBack>();

            kkCall.ColliderNames = ColliderNames;

            if (!kkCall.isSetup)
            {
                kkCall.Start();
            }

            foreach (KKCallBackWorker worker in gameObject.GetComponentsInChildren <KKCallBackWorker>(true))
            {
                workers.Add(worker);
                worker.onEnterAction = PlayOnEnter;
                worker.onExitAction  = PlayOnExit;
                worker.onStayAction  = PlayOnStay;
            }
        }
示例#2
0
        internal void AddColliderTriggers()
        {
            waterLevel = staticInstance.CelestialBody.GetAltitude(waterSurface.transform.position);

            //KKCallBack kkCall = gameObject.GetComponentInChildren<KKCallBack>(true);
            Log.Normal("WaterSurface: Adding KKCallBack to GameObject");
            KKCallBack kkCall = gameObject.AddComponent <KKCallBack>();

            kkCall.ColliderNames = ColliderNames;

            if (!kkCall.isSetup)
            {
                kkCall.Start();
            }

            foreach (KKCallBackWorker worker in gameObject.GetComponentsInChildren <KKCallBackWorker>(true))
            {
                workers.Add(worker);
                worker.onEnterAction = MakePartFloat;
                worker.onExitAction  = RemoveCustomWaterLevel;
            }
        }
示例#3
0
        internal void AddColliderTriggers()
        {
            //KKCallBack kkCall = gameObject.GetComponentInChildren<KKCallBack>(true);
            KKCallBack kkCall = gameObject.AddComponent <KKCallBack>();

            kkCall.ColliderNames = ColliderNames;

            if (!kkCall.isSetup)
            {
                kkCall.Start();
            }

            foreach (KKCallBackWorker worker in gameObject.GetComponentsInChildren <KKCallBackWorker>(true))
            {
                worker.onEnterAction = PlayOnEnter;
                worker.onExitAction  = PlayOnExit;
                if (stayAnim != null)
                {
                    worker.onStayAction = PlayOnStay;
                }
            }
        }
示例#4
0
        public static bool AddExitTriggerCallback(string uuid, Action <Part> myFunction)
        {
            if (StaticDatabase.instancedByUUID.ContainsKey(uuid))
            {
                //do stuff
                StaticInstance instance = StaticDatabase.instancedByUUID[uuid];

                KKCallBack controller = instance.gameObject.GetComponent <KKCallBack>();
                if (controller == null)
                {
                    Log.UserWarning("API:AddExitTriggerCallback: Can´t find a CallBack controller");
                    return(false);
                }

                controller.RegisterExitFunc(myFunction);
                return(true);
            }
            else
            {
                Log.UserWarning("API:AddExitTriggerCallback: Can´t find a static with the UUID: " + uuid);
                return(false);
            }
        }