Beispiel #1
0
    //private new Sprite graveMarker;

    // Use this for initialization
    void Start()
    {
        controller       = GetComponent <GamePieceController>();
        this.graveMarker = controller.graveMarker;
        stats            = GetComponent <PawnStats>();
        gameBoard        = GetComponentInParent <Board>();
    }
Beispiel #2
0
    public void SpawnAI(int choice, GameObject player)
    {
        PawnStats  selectedStats = pawnStats[choice];
        ShootStats selectedShoot = shootStats[choice];

        aiPawn = InitPawn(ai, selectedStats, selectedShoot);
    }
Beispiel #3
0
    public void SpawnPlayer(int choice)
    {
        PawnStats  selectedStats = pawnStats[choice];
        ShootStats selectedShoot = shootStats[choice];

        playerPawn = InitPawn(player, selectedStats, selectedShoot);

        SpawnAI(1, player);
    }
Beispiel #4
0
    private Pawn InitPawn(GameObject pawnObject, PawnStats stats, ShootStats shootStats)
    {
        Pawn pawn = pawnObject.GetComponent <Pawn>();

        pawn.gameManager = this;
        pawn.stats       = stats;
        pawn.pawnRenderer.material.color = stats.pawnColor;
        ShootCooldown shootCooldown = pawnObject.GetComponent <ShootCooldown>();

        shootCooldown.gameManager = this;
        Shoot shoot = pawnObject.GetComponent <Shoot>();

        shoot.gameManager = this;
        shoot.uiManager   = uiManager;
        shoot.stats       = shootStats;
        BaseUI pawnUI = pawnObject.GetComponent <BaseUI>();

        pawnUI.uiManager = uiManager;
        BaseControl pawnControl = pawnObject.GetComponent <BaseControl>();

        pawnControl.gameManager = this;
        return(pawn);
    }
Beispiel #5
0
        public static void DrawColonist(Rect rect, Pawn colonist, Map pawnMap)
        {
            float entryRectAlpha = GetEntryRectAlpha(rect);

            ApplyEntryInAnotherMapAlphaFactor(pawnMap, ref entryRectAlpha);

            bool colonistAlive = (!colonist.Dead) ? Find.Selector.SelectedObjects.Contains(colonist) : Find.Selector.SelectedObjects.Contains(colonist.Corpse);

            Color color = new Color(1f, 1f, 1f, entryRectAlpha);

            GUI.color = color;

            Color BGColor = new Color();



            Rect moodBorderRect = new Rect(rect);

            if (ColBarSettings.UseExternalMoodBar)
            {
                // draw mood border
                switch (ColBarSettings.MoodBarPos)
                {
                case Position.Alignment.Right:
                    moodBorderRect.x      = rect.xMax;
                    moodBorderRect.width /= 4;
                    break;

                case Position.Alignment.Left:
                    moodBorderRect.x      = rect.xMin - rect.width / 4;
                    moodBorderRect.width /= 4;
                    break;

                case Position.Alignment.Top:
                    moodBorderRect.x       = rect.xMin;
                    moodBorderRect.y       = rect.yMin - rect.height / 4;
                    moodBorderRect.height /= 4;
                    break;

                case Position.Alignment.Bottom:
                    moodBorderRect.x       = rect.xMin;
                    moodBorderRect.y       = moodBorderRect.yMax + SpacingLabel;
                    moodBorderRect.height /= 4;
                    break;
                }
            }

            PawnStats pawnStats = null;

            if (ColBarSettings.UseNewMood || ColBarSettings.UseExternalMoodBar)
            {
                if (PSI.PSI._statsDict.TryGetValue(colonist, out pawnStats))
                {
                    if (pawnStats.mood != null && pawnStats.mb != null)
                    {
                        if (pawnStats.mood.CurLevelPercentage <= pawnStats.mb.BreakThresholdExtreme)
                        {
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodNeutral);
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodExtremeCrossedTex);
                        }
                        else if (pawnStats.mood.CurLevelPercentage <= pawnStats.mb.BreakThresholdMajor)
                        {
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodNeutral);
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodMajorCrossedTex);
                        }
                        else if (pawnStats.mood.CurLevelPercentage <= pawnStats.mb.BreakThresholdMinor)
                        {
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodNeutral);
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodMinorCrossedTex);
                        }
                        else
                        {
                            GUI.DrawTexture(moodBorderRect, ColonistBarTextures.MoodNeutral);
                        }
                    }
                }
            }



            if (ColBarSettings.UseGender)
            {
                if (colonist.gender == Gender.Male)
                {
                    BGColor = ColBarSettings.MaleColor;
                }
                if (colonist.gender == Gender.Female)
                {
                    BGColor = ColBarSettings.FemaleColor;
                }

                if (colonist.Dead)
                {
                    BGColor = BGColor * Color.gray;
                }

                BGColor.a = entryRectAlpha;

                GUI.color = BGColor;
            }


            GUI.DrawTexture(rect, ColBarSettings.UseGender ? ColonistBarTextures.BGTexGrey : ColonistBarTextures.BGTexVanilla);

            GUI.color = color;

            if (colonist.needs != null && colonist.needs.mood != null)
            {
                if (ColBarSettings.UseExternalMoodBar || ColBarSettings.UseNewMood)
                {
                    if (pawnStats != null)
                    {
                        Rect moodRect = moodBorderRect.ContractedBy(2f);
                        DrawNewMoodRect(moodRect, pawnStats.mood, pawnStats.mb);
                    }
                }
                else
                {
                    Rect  position = rect.ContractedBy(2f);
                    float num      = position.height * colonist.needs.mood.CurLevelPercentage;
                    position.yMin   = position.yMax - num;
                    position.height = num;
                    GUI.DrawTexture(position, ColonistBarTextures.MoodBGTex);
                }
            }



            Rect rect2 = rect.ContractedBy(-2f * Scale);

            if (colonistAlive && !WorldRendererUtility.WorldRenderedNow)
            {
                DrawSelectionOverlayOnGUI(colonist, rect2);
            }
            else if (WorldRendererUtility.WorldRenderedNow && colonist.IsCaravanMember() && Find.WorldSelector.IsSelected(colonist.GetCaravan()))
            {
                DrawCaravanSelectionOverlayOnGUI(colonist.GetCaravan(), rect2);
            }

            GUI.DrawTexture(GetPawnTextureRect(rect.x, rect.y), PortraitsCache.Get(colonist, PawnTextureSize, PawnTextureCameraOffset, ColBarSettings.PawnTextureCameraZoom));

            if (ColBarSettings.UseWeaponIcons)
            {
                DrawWeaponIcon(rect, colonist);
            }

            GUI.color = new Color(1f, 1f, 1f, entryRectAlpha * 0.8f);
            DrawIcons(rect, colonist);
            GUI.color = color;
            if (colonist.Dead)
            {
                GUI.DrawTexture(rect, ColonistBarTextures.DeadColonistTex);
            }
            //       float num = 4f * Scale;
            Vector2 pos = new Vector2(rect.center.x, rect.yMax + 1f * Scale);

            GenMapUI.DrawPawnLabel(colonist, pos, entryRectAlpha, rect.width + ColonistBarDrawLocsFinderKF.SpacingHorizontal - 2f, ColonistBarColonistDrawerKF.pawnLabelsCache);
            GUI.color = Color.white;
        }