Ejemplo n.º 1
0
 void Start()
 {
     itsOrbitCam = KGFAccessor.GetObject <KGFOrbitCam>();
     itsEventSwitchToObserve.Apply();
     itsCurrentCameraRoot = eCameraRoot.eObserve;
     itsCutScene.StopCutscene();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Register itsself with KGFAccessor
 /// -> do not override, use KGFAwake() instead
 /// </summary>
 protected virtual void Awake()
 {
     KGFAccessor.AddKGFObject(this);
     EventOnAwake.Trigger(this);
     // call own KGFAwake, so user is not able to change our own basic Awake() behaviour
     KGFAwake();
 }
    private KGFOrbitCam itsKGFOrbitCam;         //reference to the orbitcam

    public void Start()
    {
        itsKGFOrbitCam = KGFAccessor.GetObject <KGFOrbitCam>();         //get the KGFOrbitcam by using the KGFAccessor class

        if (itsKGFOrbitCam != null)
        {
            float anOffset = itsKGFOrbitCam.GetEnviromentCollisionOffset();             //get the layermask for collisions
            Debug.Log("camera is located: " + anOffset + " units in front of the collision");
        }
    }
Ejemplo n.º 4
0
 /// <summary>
 /// Set the use-arrow flag of this map icon
 /// </summary>
 /// <param name="theIsArrowUsed"></param>
 public void SetArrowUsage(bool theIsArrowUsed)
 {
     itsDataMapIcon.itsUseArrow = theIsArrowUsed;
     // update KGFMinimap module
     if (itsMapSystem == null)
     {
         itsMapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (itsMapSystem != null)
     {
         itsMapSystem.RefreshIconsVisibility();
     }
 }
Ejemplo n.º 5
0
    /// <summary>
    /// Update the arrow icon of this map icon
    /// </summary>
    /// <param name="theTexture">The new texture to be used as arrow icon</param>
    public void SetTextureArrow(Texture2D theTexture)
    {
        itsDataMapIcon.itsTextureArrow = theTexture;

        // update KGFMinimap module
        if (itsMapSystem == null)
        {
            itsMapSystem = KGFAccessor.GetObject <KGFMapSystem>();
        }
        if (itsMapSystem != null)
        {
            itsMapSystem.UpdateIcon(this);
        }
    }
Ejemplo n.º 6
0
 public override void OnEnter()
 {
     if (MapSystem == null)
     {
         MapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (MapSystem != null)
     {
     }
     else
     {
         LogError("Could not find mapsystem object in scene");
     }
 }
Ejemplo n.º 7
0
    /// <summary>
    /// Setter for the color
    /// </summary>
    /// <param name="theColor"></param>
    public void SetColor(Color theColor)
    {
        itsDataMapIcon.itsColor = theColor;

        // update KGFMinimap module
        if (itsMapSystem == null)
        {
            itsMapSystem = KGFAccessor.GetObject <KGFMapSystem>();
        }
        if (itsMapSystem != null)
        {
            itsMapSystem.UpdateIcon(this);
        }
    }
Ejemplo n.º 8
0
    /// <summary>
    /// Change the visibility of the map icon
    /// </summary>
    /// <param name="theVisibility"></param>
    public void SetVisibility(bool theVisibility)
    {
        // change visibility
        itsMapIconIsVisible = theVisibility;

        // update KGFMinimap module
        if (itsMapSystem == null)
        {
            itsMapSystem = KGFAccessor.GetObject <KGFMapSystem>();
        }
        if (itsMapSystem != null)
        {
            itsMapSystem.RefreshIconsVisibility();
        }
    }
Ejemplo n.º 9
0
 public override void OnEnter()
 {
     if (MapSystem == null)
     {
         MapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (MapSystem != null)
     {
         MapSystem.EventMouseMapIconClicked += OnMapIconClick;
     }
     else
     {
         LogError("Please a add map icon to this action.");
     }
 }
Ejemplo n.º 10
0
 public override void OnEnter()
 {
     if (MapSystem == null)
     {
         MapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (MapSystem != null)
     {
         MapSystem.SetIconsVisibleByCategory(IconCategory.Value, ZoomValue.Value);
     }
     else
     {
         LogError("Could not find mapsystem object in scene");
     }
     Finish();
 }
Ejemplo n.º 11
0
 public override void OnEnter()
 {
     if (MapSystem == null)
     {
         MapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (MapSystem != null)
     {
         MapSystem.SetFullscreen(Visibility.Value);
     }
     else
     {
         LogError("Could not find mapsystem object in scene");
     }
     Finish();
 }
Ejemplo n.º 12
0
 public override void OnEnter()
 {
     if (MapSystem == null)
     {
         MapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (MapSystem != null)
     {
         MapSystem.SetMinimapEnabled(MinimapEnable.Value);
     }
     else
     {
         LogError("Could not find mapsystem object in scene");
     }
     Finish();
 }
Ejemplo n.º 13
0
    protected override void KGFAwake()
    {
        base.KGFAwake();
        if (itsInstance == null)
        {
            itsInstance = this;
        }
        else
        {
            UnityEngine.Object.Destroy(this);
        }

        KGFAccessor.RegisterAddEvent <KGFICustomGUI>(OnCustomGuiChanged);
        KGFAccessor.RegisterRemoveEvent <KGFICustomGUI>(OnCustomGuiChanged);
        UpdateInternalList();
    }
    /// <summary>
    /// Update the style of the map system
    /// </summary>
    /// <param name="theIndex"></param>
    void UpdateStyle(int theIndex)
    {
        MapSystemStyle aStyle = itsStyles[theIndex];

        KGFMapSystem aMapSystem = KGFAccessor.GetObject <KGFMapSystem>();

        if (aMapSystem != null)
        {
            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsBackground     = aStyle.itsBackgroundMap;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsBackground = aStyle.itsBackgroundMinimap;

            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsButton      = aStyle.itsButton;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsButtonHover = aStyle.itsButtonHover;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsButtonDown  = aStyle.itsButtonDown;

            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsButton      = aStyle.itsButton;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsButtonHover = aStyle.itsButtonHover;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsButtonDown  = aStyle.itsButtonDown;


            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsIconZoomIn     = aStyle.itsButtonZoomIn;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsIconZoomOut    = aStyle.itsButtonZoomOut;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsIconFullscreen = aStyle.itsButtonMap;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsIconZoomLock   = aStyle.itsButtonLock;
            aMapSystem.itsDataModuleMinimap.itsGlobalSettings.itsColorMap          = aStyle.itsColorMap;

            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsIconZoomIn     = aStyle.itsButtonZoomIn;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsIconZoomOut    = aStyle.itsButtonZoomOut;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsIconFullscreen = aStyle.itsButtonMap;
            aMapSystem.itsDataModuleMinimap.itsAppearanceMap.itsIconZoomLock   = aStyle.itsButtonLock;

            aMapSystem.SetMask(aStyle.itsMinimapMask, aStyle.itsMapMask);
            aMapSystem.itsDataModuleMinimap.itsAppearanceMiniMap.itsButtonPadding = aStyle.itsPaddingButtons;
            aMapSystem.itsDataModuleMinimap.itsGlobalSettings.itsColorAll         = aStyle.itsColorAll;

            aMapSystem.itsDataModuleMinimap.itsViewport.itsColor = aStyle.itsViewportColor;

            aMapSystem.itsDataModuleMinimap.itsToolTip.itsTextureBackground = aStyle.itsBackgroundTooltip;

            aMapSystem.UpdateStyles();
        }

//		itsGuiStyle = new GUIStyle();
//		itsGuiStyle.normal.background = aStyle.itsButton;
//		itsGuiStyle.hover.background = aStyle.itsButtonHover;
//		itsGuiStyle.active.background = aStyle.itsButtonDown;
    }
Ejemplo n.º 15
0
    protected override void KGFAwake()
    {
        if (itsInstance == null)
        {
            itsInstance = this;
        }
        else
        {
            UnityEngine.Object.Destroy(this);
        }

        // Add all custom guis that are already there
        foreach (KGFICustomGUI aGui in KGFAccessor.GetObjects <KGFICustomGUI>())
        {
            Add(aGui);
        }
        // Add all future custom guis
        KGFAccessor.RegisterAddEvent <KGFICustomGUI>(OnAddCustomGui);
    }
Ejemplo n.º 16
0
    void Update()
    {
        if (itsDataMapIcon.itsRevealFogOfWar)
        {
            if (itsMapSystem == null)
            {
                itsMapSystem = KGFAccessor.GetObject <KGFMapSystem>();
            }
            if (itsMapSystem != null)
            {
                itsMapSystem.RevealFogOfWarAtPoint(itsTransformCache.position);
            }
        }

        if (itsDataMapIcon.itsBlinking)
        {
            float aBlinkValue = KGFUtility.PingPong(Time.time, 1, 0, 0, 0.6f);
            itsMaterial.color = new Color(itsDataMapIcon.itsColor.r, itsDataMapIcon.itsColor.g, itsDataMapIcon.itsColor.b, aBlinkValue);
        }
    }
Ejemplo n.º 17
0
 public override void OnEnter()
 {
     if (MapSystem == null)
     {
         MapSystem = KGFAccessor.GetObject <KGFMapSystem>();
     }
     if (MapSystem != null)
     {
         if (MapSystem.GetIsVisibleOnMap(MapIcon) == Visibility.Value)
         {
             Finish();
         }
         else
         {
             MapSystem.EventVisibilityOnMinimapChanged += OnVisibilityChanged;
         }
     }
     else
     {
         LogError("Please a add map icon to this action.");
     }
 }
Ejemplo n.º 18
0
    private KGFOrbitCam itsKGFOrbitCam;         //reference to the orbitcam

    public void Start()
    {
        itsKGFOrbitCam = KGFAccessor.GetObject <KGFOrbitCam>();         //get the KGFOrbitcam by using the KGFAccessor class
    }
Ejemplo n.º 19
0
 void Start()
 {
     miniMap = GameObject.Find("MiniMap").GetComponent <KGFMapSystem>();
     KGFAccessor.GetExternal <KGFMapSystem>(OnMapSystemRegistered);
 }
Ejemplo n.º 20
0
        void TriggerRuntimeSearch(MonoBehaviour theCaller, object[] theRuntimeParameters)
        {
            Type aType = GetRuntimeType();

            if (aType == null)
            {
                LogError("could not find type", itsEventCategory, theCaller);
                return;
            }
            if (itsMethodName == null)
            {
                LogError("event has no selected method", itsEventCategory, theCaller);
                return;
            }

            // find method
            MethodInfo    aFoundMethod;
            MonoBehaviour aFoundComponent;

            if (!FindMethod(this, out aFoundMethod, out aFoundComponent))
            {
                LogError("Could not find method on object.", itsEventCategory, theCaller);
                return;
            }

            // convert parameters
            object [] aParametersList = null;
            if (GetDirectPassThroughMode())
            {
                aParametersList = theRuntimeParameters;
                // check parameter right types
            }
            else
            {
                // convert parameters set in this event
                ParameterInfo [] aParameterInfoArray = aFoundMethod.GetParameters();
                aParametersList = ConvertParameters(aParameterInfoArray, itsParameters);
                // convert linked parameters and add to the list
                for (int i = 0; i < itsParameters.Length; i++)
                {
                    if (GetIsParameterLinked(i))
                    {
                        int anIndex = GetParameterIndexWithType(GetParameterLink(i), aParameterInfoArray[i].ParameterType.FullName);
                        if (anIndex < theRuntimeParameters.Length)
                        {
                            aParametersList[i] = theRuntimeParameters[anIndex];
                        }
                        else
                        {
                            Debug.LogError("you did not give enough parameters");
                        }
                    }
                }
            }

//			// debug
//			foreach (object anObject in aParametersList)
//			{
//				print(" - "+anObject+ " / "+anObject.GetType());
//			}

            // call method
            List <MonoBehaviour> afoundObjectList = new List <MonoBehaviour>();

            try
            {
                if (aType.IsInterface || typeof(KGFObject).IsAssignableFrom(aType))
                {
                    // use fast kgfaccessor method
                    foreach (object anObject in KGFAccessor.GetObjects(aType))
                    {
                        MonoBehaviour aMonobehaviour = anObject as MonoBehaviour;
                        if (aMonobehaviour != null)
                        {
                            if (CheckRuntimeObjectName(aMonobehaviour))
                            {
                                aFoundMethod.Invoke(anObject, aParametersList);
                                afoundObjectList.Add(aMonobehaviour);
                            }
                        }
                    }
                }
                else if (!aType.IsInterface)
                {
                    foreach (object anObject in GameObject.FindObjectsOfType(aType))
                    {
                        MonoBehaviour aMonobehaviour = anObject as MonoBehaviour;
                        if (aMonobehaviour != null)
                        {
                            if (CheckRuntimeObjectName(aMonobehaviour))
                            {
                                aFoundMethod.Invoke(anObject, aParametersList);
                                afoundObjectList.Add(aMonobehaviour);
                            }
                        }
                    }
                }
            } catch (Exception e)
            {
                LogError("invoked method caused exception in event_generic:" + e, itsEventCategory, theCaller);
            }

            // log call
            List <string> aParamStringList = new List <string> ();

            if (aParametersList != null)
            {
                foreach (object aParam in aParametersList)
                {
                    aParamStringList.Add("" + aParam);
                }
            }

            foreach (MonoBehaviour aMonoBehaviour in afoundObjectList)
            {
                string aLogInfo = string.Format("{0}({1}): {2} ({3})", aMonoBehaviour.name, itsRuntimeObjectSearchType, aFoundMethod.Name, string.Join(",", aParamStringList.ToArray()));
                LogDebug(aLogInfo, itsEventCategory, theCaller);
            }
        }
Ejemplo n.º 21
0
 protected override void KGFAwake()
 {
     itsGUIs = KGFAccessor.GetObjects <KGFIGui2D>();
     KGFAccessor.RegisterAddEvent <KGFIGui2D>(OnRegisterKGFIGui2D);
     KGFAccessor.RegisterRemoveEvent <KGFIGui2D>(OnUnregisterKGFIGui2D);
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Un-Register itsself with KGFAccessor
 /// </summary>
 void OnDestroy()
 {
     EventOnDestroy.Trigger(this);
     KGFAccessor.RemoveKGFObject(this);
     KGFDestroy();
 }
Ejemplo n.º 23
0
 void UpdateInternalList()
 {
     itsCustomGuiList = KGFAccessor.GetObjects <KGFICustomGUI>();
 }