Exemple #1
0
 void OnTriggerEnter(Collider col)
 {
     if (col.transform.tag == type.ToString())
     {
         Debug.Log(col.transform.name);
         sp.ObjReturn(col.gameObject);
     }
 }
Exemple #2
0
        private bool ChangeSpawnType(GUIButton button, object obj)
        {
            GUITextBlock spawnTypeText = button.Parent as GUITextBlock;

            spawnType += (int)button.UserData;

            if (spawnType > SpawnType.Cargo)
            {
                spawnType = SpawnType.Human;
            }
            if (spawnType < SpawnType.Human)
            {
                spawnType = SpawnType.Cargo;
            }

            spawnTypeText.Text = spawnType.ToString();

            return(true);
        }
Exemple #3
0
        public void Draw(SpriteBatch spriteBatch, Vector2 drawPos)
        {
            Color clr = CurrentHull == null ? Color.DodgerBlue : GUI.Style.Green;

            if (spawnType != SpawnType.Path)
            {
                clr = Color.Gray;
            }
            if (isObstructed)
            {
                clr = Color.Black;
            }
            if (IsHighlighted || IsHighlighted)
            {
                clr = Color.Lerp(clr, Color.White, 0.8f);
            }

            int iconSize = spawnType == SpawnType.Path ? WaypointSize : SpawnPointSize;

            if (ConnectedDoor != null || Ladders != null || Stairs != null || SpawnType != SpawnType.Path)
            {
                iconSize = (int)(iconSize * 1.5f);
            }

            if (IsSelected || IsHighlighted)
            {
                int glowSize = (int)(iconSize * 1.5f);
                GUI.Style.UIGlowCircular.Draw(spriteBatch,
                                              new Rectangle((int)(drawPos.X - glowSize / 2), (int)(drawPos.Y - glowSize / 2), glowSize, glowSize),
                                              Color.White);
            }

            Sprite sprite = iconSprites[SpawnType.ToString()];

            if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
            {
                sprite = iconSprites["Path"];
            }
            else if (ConnectedDoor != null)
            {
                sprite = iconSprites["Door"];
            }
            else if (Ladders != null)
            {
                sprite = iconSprites["Ladder"];
            }
            sprite.Draw(spriteBatch, drawPos, clr, scale: iconSize / (float)sprite.SourceRect.Width, depth: 0.001f);
            sprite.RelativeOrigin = Vector2.One * 0.5f;
            if (spawnType == SpawnType.Human && AssignedJob?.Icon != null)
            {
                AssignedJob.Icon.Draw(spriteBatch, drawPos, AssignedJob.UIColor, scale: iconSize / (float)AssignedJob.Icon.SourceRect.Width * 0.8f, depth: 0.0f);
            }

            foreach (MapEntity e in linkedTo)
            {
                GUI.DrawLine(spriteBatch,
                             drawPos,
                             new Vector2(e.DrawPosition.X, -e.DrawPosition.Y),
                             (isObstructed ? Color.Gray : GUI.Style.Green) * 0.7f, width: 5, depth: 0.002f);
            }
            if (ConnectedGap != null)
            {
                GUI.DrawLine(spriteBatch,
                             drawPos,
                             new Vector2(ConnectedGap.WorldPosition.X, -ConnectedGap.WorldPosition.Y),
                             GUI.Style.Green * 0.5f, width: 1);
            }
            if (Ladders != null)
            {
                GUI.DrawLine(spriteBatch,
                             drawPos,
                             new Vector2(Ladders.Item.WorldPosition.X, -Ladders.Item.WorldPosition.Y),
                             GUI.Style.Green * 0.5f, width: 1);
            }

            GUI.SmallFont.DrawString(spriteBatch,
                                     ID.ToString(),
                                     new Vector2(DrawPosition.X - 10, -DrawPosition.Y - 30),
                                     Color.WhiteSmoke);
        }