示例#1
0
            /// <summary>
            /// Updates layout for the element and its children. Overriding this method is rarely necessary.
            /// If you need to update layout, use Layout().
            /// </summary>
            public override void BeginLayout(bool refresh)
            {
                if (!ExceptionHandler.ClientsPaused)
                {
                    try
                    {
                        layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData, _parent);

                        if (_parent == null)
                        {
                            ParentVisible = false;
                        }
                        else
                        {
                            ParentVisible = _parent.Visible;
                        }

                        if (Visible || refresh)
                        {
                            Layout();
                        }
                    }
                    catch (Exception e)
                    {
                        ExceptionHandler.ReportException(e);
                    }
                }
            }
示例#2
0
 //== MESSAGES ==
 private void Start()
 {
     //Intialize the Array for Docks
     slots         = new DockSlot[slotCount];
     enemiesParent = ParentUtils.FindEnemiesParent();
     CreateSlots();
 }
示例#3
0
 // Use this for initialization
 void Start()
 {
     enemyParent = ParentUtils.FindEnemyParent();
     // get the list of child object
     spawnPoints = GetComponentsInChildren <SpawnPoint>();
     SpawnEnemiesRepeating();
 }
    // Start is called before the first frame update
    void Start()
    {
        // Create a temporary reference to the current scene.
        Scene currentScene = SceneManager.GetActiveScene();

        // Retrieve the name of this scene.
        string sceneName = currentScene.name;

        // set the delay of the enemy depending on which level the player is on
        if (sceneName == "GameSceneL1")
        {
            spawnDelay = 30.0f;
        }
        else if (sceneName == "GameSceneL2")
        {
            spawnDelay = 20.0f;
        }
        else if (sceneName == "GameSceneL3")
        {
            spawnDelay = 20.0f;
        }

        // get the enemey parent object
        enemyParent = ParentUtils.GetEnemyParent();
        // need to get a list of spawn points
        spawnPoints = GetComponentsInChildren <SpawnPoint>();
        SpawnRepeating();
    }
示例#5
0
                protected override void Layout()
                {
                    // Reverse scaling due to differences between rendering resolution and
                    // desktop resolution when running the game in windowed mode
                    Vector2 desktopSize      = MyAPIGateway.Input.GetMouseAreaSize();
                    Vector2 invMousePosScale = new Vector2
                    {
                        X = ScreenWidth / desktopSize.X,
                        Y = ScreenHeight / desktopSize.Y,
                    };

                    Vector2 screenPos = MyAPIGateway.Input.GetMousePosition() * invMousePosScale;

                    // Update world line
                    WorldLine = MyAPIGateway.Session.Camera.WorldLineFromScreen(screenPos);

                    // Reverse Y-axis direction and offset the cursor position s.t. it's
                    // centered in the middle of the screen rather than the upper left
                    // corner.
                    screenPos.Y *= -1f;
                    screenPos   += new Vector2(-ScreenWidth * .5f, ScreenHeight * .5f);

                    // Calculate position of the cursor in world space
                    MatrixD  ptw      = HudMain.PixelToWorld;
                    Vector3D worldPos = new Vector3D(screenPos.X, screenPos.Y, 0d);

                    Vector3D.TransformNoProjection(ref worldPos, ref ptw, out worldPos);

                    WorldPos  = worldPos;
                    ScreenPos = screenPos;

                    // Update custom hud space and tooltips
                    HudSpaceData?hudSpaceData = GetCapturedHudSpaceFunc?.Invoke();
                    bool         useCapturedHudSpace = hudSpaceData != null && hudSpaceData.Value.Item1;
                    bool         boundTooltips = false, useScreenSpace = true;
                    float        tooltipScale = 1f;

                    if (useCapturedHudSpace)
                    {
                        PlaneToWorldRef[0] = hudSpaceData.Value.Item3;
                        useScreenSpace     =
                            PlaneToWorldRef[0].EqualsFast(ref HighDpiRoot.HudSpace.PlaneToWorldRef[0]) ||
                            PlaneToWorldRef[0].EqualsFast(ref Root.HudSpace.PlaneToWorldRef[0]);
                    }

                    if (useScreenSpace)
                    {
                        PlaneToWorldRef[0] = HighDpiRoot.HudSpace.PlaneToWorldRef[0];
                        boundTooltips      = true;
                        tooltipScale       = ResScale;
                    }

                    base.Layout();

                    cursorBox.Visible     = !MyAPIGateway.Gui.IsCursorVisible;
                    layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData, _parent);
                    cursorBox.Offset      = new Vector2(CursorPos.X, CursorPos.Y);
                    UpdateToolTip(boundTooltips, tooltipScale);
                }
 void Start()
 {
     // get the enemey parent object
     enemyParent = ParentUtils.GetEnemyParent();
     // need to get a list of spawn points
     spawnPoints = GetComponentsInChildren <SpawnPoint>();
     SpawnRepeating();
 }
示例#7
0
        public static event EnemyKilled EnemyKilledEvent; // Event


        // == Messages ==
        private void Start()
        {
            explosionsParent = ParentUtils.FindExplosionsParent();

            //Find SoundController
            soundController = SoundController.FindSoundController();

            PlayClip(spawnClip);
        }
示例#8
0
        //= Messages ==
        protected virtual void Start()
        {
            enemiesParent = ParentUtils.FindEnemiesParent();

            if (SpawnOnStart)
            {
                EnableSpawning();
            }
        }
示例#9
0
    private List <Locker> lockers;   // List of enemies
    #endregion

    // Start is called before the first frame update
    void Start()
    {
        lockers = new List <Locker>();

        /*
         * Using the ParentUtils class, get the locker parent object. An attempt to find the game object is made first.
         * If unable to be found, the game object is created
         */
        lockerParent = ParentUtils.GetLockerParent();
    }
示例#10
0
    private List <Enemy> enemies;   // List of enemies
    #endregion

    // Start is called before the first frame update
    void Start()
    {
        enemies = new List <Enemy>(); // Instantiate new list of enemies

        /*
         * Using the ParentUtils class, get the enemy parent object. An attempt to find the game object is made first.
         * If unable to be found, the game object is created
         */
        enemyParent = ParentUtils.GetEnemyParent();
    }
示例#11
0
        // == Messages ==
        private void Start()
        {
            //Need to get the components at the start
            spriteRenderer   = GetComponent <SpriteRenderer>();
            polygonCollider  = GetComponent <PolygonCollider2D>();
            playerController = GetComponent <PlayerController>();
            weaponController = GetComponent <WeaponController>();

            //Remember the start position
            startPoisiton = new Vector3(transform.position.x, transform.position.y, transform.position.z);

            soundController  = SoundController.FindSoundController();
            explosionsParent = ParentUtils.FindExplosionsParent();
        }
            public override void GetUpdateAccessors(List <HudUpdateAccessors> UpdateActions, byte preloadDepth)
            {
                layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData, _parent);
                UpdateActions.EnsureCapacity(UpdateActions.Count + children.Count + 1);
                accessorDelegates.Item2.Item2 = GetNodeOriginFunc;

                UpdateActions.Add(accessorDelegates);

                if (Visible && IsInFront)
                {
                    for (int n = 0; n < children.Count; n++)
                    {
                        children[n].GetUpdateAccessors(UpdateActions, preloadDepth);
                    }
                }
            }
            /// <summary>
            /// Adds update delegates for members in the order dictated by the UI tree
            /// </summary>
            public virtual void GetUpdateAccessors(List <HudUpdateAccessors> UpdateActions, byte preloadDepth)
            {
                if (Visible)
                {
                    layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData);

                    UpdateActions.EnsureCapacity(UpdateActions.Count + children.Count + 1);
                    accessorDelegates.Item2.Item2 = HudSpace.GetNodeOriginFunc;

                    UpdateActions.Add(accessorDelegates);

                    for (int n = 0; n < children.Count; n++)
                    {
                        children[n].GetUpdateAccessors(UpdateActions, preloadDepth);
                    }
                }
            }
            /// <summary>
            /// Starts layout update in a try-catch block. Useful for manually updating UI elements.
            /// Exceptions are reported client-side. Do not override this unless you have a good reason for it.
            /// If you need to update layout, use Layout().
            /// </summary>
            public virtual void BeginLayout(bool refresh)
            {
                if (!ExceptionHandler.ClientsPaused)
                {
                    try
                    {
                        layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData);

                        if (Visible || refresh)
                        {
                            Layout();
                        }
                    }
                    catch (Exception e)
                    {
                        ExceptionHandler.ReportException(e);
                    }
                }
            }
示例#15
0
            /// <summary>
            /// Adds update delegates for members in the order dictated by the UI tree
            /// </summary>
            public override void GetUpdateAccessors(List <HudUpdateAccessors> UpdateActions, byte preloadDepth)
            {
                bool wasSetVisible = (State & HudElementStates.IsVisible) > 0;

                State |= HudElementStates.WasParentVisible;

                if (!wasSetVisible && (State & HudElementStates.CanPreload) > 0)
                {
                    preloadDepth++;
                }

                if (preloadDepth < maxPreloadDepth && (State & HudElementStates.CanPreload) > 0)
                {
                    State |= HudElementStates.IsVisible;
                }

                if (Visible)
                {
                    HudSpace = _parent?.HudSpace;
                    layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData, _parent);

                    UpdateActions.EnsureCapacity(UpdateActions.Count + children.Count + 1);
                    accessorDelegates.Item2.Item2 = HudSpace.GetNodeOriginFunc;

                    UpdateActions.Add(accessorDelegates);;

                    for (int n = 0; n < children.Count; n++)
                    {
                        children[n].GetUpdateAccessors(UpdateActions, preloadDepth);
                    }
                }

                if (!wasSetVisible)
                {
                    State &= ~HudElementStates.IsVisible;
                }
            }
            /// <summary>
            /// Updates layout for the element and its children. Overriding this method is rarely necessary.
            /// If you need to update layout, use Layout().
            /// </summary>
            public override void BeginLayout(bool refresh)
            {
                if (!ExceptionHandler.ClientsPaused)
                {
                    try
                    {
                        layerData.fullZOffset = ParentUtils.GetFullZOffset(layerData, _parent);

                        if (_parent == null)
                        {
                            ParentVisible = false;
                        }
                        else
                        {
                            ParentVisible = _parent.Visible;
                        }

                        if (Visible || refresh)
                        {
                            UpdateCache();
                            Layout();

                            // Update cached values for use on draw and by child nodes
                            cachedPadding  = Padding;
                            cachedSize     = new Vector2(Width, Height);
                            cachedPosition = cachedOrigin + Offset;

                            UpdateMasking();
                        }
                    }
                    catch (Exception e)
                    {
                        ExceptionHandler.ReportException(e);
                    }
                }
            }
示例#17
0
 // == Messages ==
 private void Start()
 {
     bulletsParent   = ParentUtils.FindBulletsParent();
     soundController = SoundController.FindSoundController();
 }
示例#18
0
 // == private methods ==
 private void Start()
 {
     enemyParent = ParentUtils.FindEnemyParent();
     SpawnRepeating();
 }
    // Start is called before the first frame update
    void Start()
    {
        bulletParent = ParentUtils.GetBulletParent();

        soundController = SoundController.FindSoundController();
    }
 // Start is called before the first frame update
 void Start()
 {
     bulletParent = ParentUtils.GetBulletParent();
 }
 // Start is called before the first frame update
 void Start()
 {
     starParent  = ParentUtils.GetStarParent();
     spawnPoints = GetComponentsInChildren <SpawnPoint>();
     SpawnRepeating();
 }
示例#22
0
 // == private methods ==
 private void Start()
 {
     bulletParent = ParentUtils.FindBulletParent();
 }