예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     enemyAI      = GetComponent <Animator>();
     navMeshAgent = GetComponent <NavMeshAgent>();
     rigidbody    = GetComponent <Rigidbody>();
     targetCount  = gameObject.transform.parent.GetComponent <TargetCount>();
     if (isScared)
     {
         enemyAI.SetBool("scared", isScared);
     }
 }
예제 #2
0
    public override int GetHashCode()
    {
        int hashcode = 157;

        unchecked {
            if (__isset.mid)
            {
                hashcode = (hashcode * 397) + Mid.GetHashCode();
            }
            if (__isset.freshnessLifetime)
            {
                hashcode = (hashcode * 397) + FreshnessLifetime.GetHashCode();
            }
            if (__isset.onAirId)
            {
                hashcode = (hashcode * 397) + OnAirId.GetHashCode();
            }
            if (__isset.onAir)
            {
                hashcode = (hashcode * 397) + OnAir.GetHashCode();
            }
            if (__isset.text)
            {
                hashcode = (hashcode * 397) + Text.GetHashCode();
            }
            if (__isset.viewerCount)
            {
                hashcode = (hashcode * 397) + ViewerCount.GetHashCode();
            }
            if (__isset.targetCount)
            {
                hashcode = (hashcode * 397) + TargetCount.GetHashCode();
            }
            if (__isset.onAirType)
            {
                hashcode = (hashcode * 397) + OnAirType.GetHashCode();
            }
            if (__isset.onAirUrls)
            {
                hashcode = (hashcode * 397) + OnAirUrls.GetHashCode();
            }
        }
        return(hashcode);
    }
예제 #3
0
 private TargetType(string name, TargetCount targetCount, Func <Character, Page, ICollection <Character> > getFunc)
 {
     this.Name        = name;
     this.TargetCount = targetCount;
     this.getFunc     = getFunc;
 }
예제 #4
0
        public void OnGUI(Rect rect)
        {
            float curY            = 0f;
            float repeatModeButX  = 0f;
            float adjustButHeight = 30f;

            try
            {
                GUI.BeginGroup(rect);
                //Do the top buttons. If the parent is not null, then do the suspend button.
                if (!setupStage)
                {
                    float suspendButRightEdge = rect.width / 2f - 5f;
                    Rect  suspendButRect      = new Rect(0f, 0f, suspendButRightEdge, buttonSize.y);
                    if (Suspended)
                    {
                        if (Widgets.TextButton(suspendButRect, "Suspended".Translate()))
                        {
                            Suspended = false;
                        }
                    }
                    else
                    {
                        if (Widgets.TextButton(suspendButRect, "NotSuspended".Translate()))
                        {
                            Suspended = true;
                        }
                    }
                    repeatModeButX = rect.width / 2f + 5f;
                }
                string label = "But";
                if (repeatMode == BillRepeatMode.RepeatCount)
                {
                    label = "DoXTimes".Translate();
                }
                if (repeatMode == BillRepeatMode.TargetCount)
                {
                    label = "DoUntilYouHaveX".Translate();
                }
                if (repeatMode == BillRepeatMode.Forever)
                {
                    label = "DoForever".Translate();
                }
                Vector2 repeatButSize = new Vector2(rect.width - repeatModeButX, buttonSize.y);
                Rect    repeatButRect = new Rect(repeatModeButX, curY, repeatButSize.x, repeatButSize.y);
                if (Widgets.TextButton(repeatButRect, label))
                {
                    List <FloatMenuOption> list = new List <FloatMenuOption>();
                    list.Add(new FloatMenuOption("DoXTimes".Translate(), delegate
                    {
                        this.repeatMode = BillRepeatMode.RepeatCount;
                    }));
                    list.Add(new FloatMenuOption("DoUntilYouHaveX".Translate(), delegate
                    {
                        this.repeatMode = BillRepeatMode.TargetCount;
                    }));
                    list.Add(new FloatMenuOption("DoForever".Translate(), delegate
                    {
                        this.repeatMode = BillRepeatMode.Forever;
                    }));
                    Find.WindowStack.Add(new FloatMenu(list));
                }
                curY += repeatButSize.y + margin;

                //Do the target count label
                Rect countRect = new Rect(0, curY, rect.width, 30f);
                curY += countRect.height + margin;
                string text = string.Empty;
                if (this.repeatMode == BillRepeatMode.RepeatCount)
                {
                    text = "RepeatCount".Translate(new object[] {
                        Cycles.ToString()
                    });
                    float butPadding = 2f;
                    float butWidth   = (rect.width - 8 * butPadding) / 5f;
                    float xPos       = 0f;
                    Rect  but1Rect   = new Rect(xPos, curY, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but1Rect, "-25"))
                    {
                        if (Cycles == 0)
                        {
                            SoundStarter.PlayOneShot(SoundDefOf.ClickReject, SoundInfo.OnCamera());
                        }
                        else
                        {
                            Cycles -= 25;
                        }
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but2Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but2Rect, "-1"))
                    {
                        if (Cycles == 0)
                        {
                            SoundStarter.PlayOneShot(SoundDefOf.ClickReject, SoundInfo.OnCamera());
                        }
                        else
                        {
                            Cycles -= 1;
                        }
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but3Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but3Rect, "1"))
                    {
                        Cycles = 1;
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but4Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but4Rect, "+1"))
                    {
                        Cycles += 1;
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but5Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but5Rect, "+25"))
                    {
                        Cycles += 25;
                    }
                }
                else if (repeatMode == BillRepeatMode.TargetCount)
                {
                    text = "TargetCount".Translate(new object[] {
                        (TargetCount >= 999999)?"Infinite".Translate() : TargetCount.ToString()
                    });
                    float butPadding = 2f;
                    float butWidth   = (rect.width - 12 * butPadding) / 7f;
                    float xPos       = 0f;
                    Rect  but1Rect   = new Rect(xPos, curY, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but1Rect, "-250"))
                    {
                        if (TargetCount == 0)
                        {
                            SoundStarter.PlayOneShot(SoundDefOf.ClickReject, SoundInfo.OnCamera());
                        }
                        else
                        {
                            TargetCount -= 250;
                        }
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but2Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but2Rect, "-25"))
                    {
                        if (TargetCount == 0)
                        {
                            SoundStarter.PlayOneShot(SoundDefOf.ClickReject, SoundInfo.OnCamera());
                        }
                        else
                        {
                            TargetCount -= 25;
                        }
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but3Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but3Rect, "-1"))
                    {
                        if (TargetCount == 0)
                        {
                            SoundStarter.PlayOneShot(SoundDefOf.ClickReject, SoundInfo.OnCamera());
                        }
                        else
                        {
                            TargetCount -= 1;
                        }
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but4Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but4Rect, "1"))
                    {
                        TargetCount = 1;
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but5Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but5Rect, "+1"))
                    {
                        TargetCount += 1;
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but6Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but6Rect, "+25"))
                    {
                        TargetCount += 25;
                    }
                    xPos += butWidth + butPadding * 2;
                    Rect but7Rect = new Rect(xPos, but1Rect.y, butWidth, adjustButHeight);
                    if (Widgets.TextButton(but7Rect, "+250"))
                    {
                        TargetCount += 250;
                    }
                }
                else if (repeatMode == BillRepeatMode.Forever)
                {
                    text = "Do Forever";
                }
                else
                {
                    throw new InvalidOperationException();
                }
                curY += adjustButHeight + margin + 6f;

                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(countRect, text);
                //Now for the ThingFilter box (shiver)
                Rect thingFilterLabelRect = new Rect(0f, curY, rect.width, 20f);
                curY += thingFilterLabelRect.height + margin;
                Widgets.Label(thingFilterLabelRect, "PermittedIngredients".Translate());
                Text.Anchor = TextAnchor.UpperLeft;

                float tfheight        = rect.height - curY - adjustButHeight - margin;
                Rect  thingFilterRect = new Rect(0f, curY, rect.width, tfheight);
                curY += tfheight + margin;
                ThingFilterUI.DoThingFilterConfigWindow(thingFilterRect, ref this.scrollPosition, this.ingredientsFilter, this.recipe.fixedIngredientFilter);
                //Well that wasn't so hard after all
                float checkWidth = rect.width / 2 - 30f;
                float checkXPos  = rect.width / 2 - (checkWidth / 2);
                Rect  checkRect  = new Rect(checkXPos, curY, checkWidth, adjustButHeight);
                Widgets.LabelCheckbox(checkRect, "Complete all", ref this.completeAll);
                string s = "Activating this will set the Assembly line to send down the completed products once all cycles of the order have been completed, or when it has completed 15 cycles. This helps reduce the number of incoming drops when the completion time of the recipe is very quick.";
                if (RepeatMode == BillRepeatMode.TargetCount)
                {
                    s = "Activating this will set the Assembly line to send down the completed products once all cycles of the order have been completed, or when it has completed 5 cycles. This helps reduce the number of incoming drops when the completion time of the recipe is very quick.";
                }
                TipSignal tip = new TipSignal(s);
                TooltipHandler.TipRegion(checkRect, tip);
            }
            finally
            {
                GUI.EndGroup();
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
            }
        }
예제 #5
0
    public static List <Fighter> GetTargettableFighters(Fighter originator, TargetCount targetCount, TargetSelection targetSelection, bool excludeSelf, TargetStatus targetStatus, ActionAttribute attackAttribute, TargetPosition targetPosition, TargetElevation targetElevation)
    {
        List <Fighter> targettableFighters = new List <Fighter>();

        if (targetCount == TargetCount.AllFighters)
        {
            // Allys first
            targettableFighters.AddRange(originator.FighterTeam.TeamMembers);
            // Reverse ally order for navigation
            targettableFighters.Reverse();

            if (excludeSelf)
            {
                targettableFighters.Remove(originator);
            }
            targettableFighters.AddRange(originator.FighterTeam.opposingTeam.TeamMembers);
        }
        else
        {
            switch (targetSelection)
            {
            case TargetSelection.Ally:
                targettableFighters.AddRange(originator.FighterTeam.TeamMembers);
                if (excludeSelf)
                {
                    targettableFighters.Remove(originator);
                }
                break;

            case TargetSelection.Enemy:
                targettableFighters.AddRange(originator.FighterTeam.opposingTeam.TeamMembers);
                break;

            case TargetSelection.Self:
                targettableFighters.Add(originator);
                break;
            }
        }

        for (int i = targettableFighters.Count - 1; i >= 0; i--)
        {
            if (!FighterIsOnTargetableElevation(targettableFighters[i], targetElevation))
            {
                targettableFighters.RemoveAt(i);
                continue;
            }

            // Positional actions will never focus on all teams, so lets do this conditionally
            switch (targetPosition)
            {
            case TargetPosition.Front:
                if (i > 0)
                {
                    targettableFighters.RemoveAt(i);
                    continue;
                }
                break;

            case TargetPosition.Rear:
                if (i < targettableFighters.Count - 1)
                {
                    targettableFighters.RemoveAt(i);
                }
                break;
            }

            if (!FighterHasTargetableStatuses(targettableFighters[0], targetStatus))
            {
                targettableFighters.RemoveAt(i);
            }

            if (!FighterHasTargetableAttributes(targettableFighters[0], attackAttribute))
            {
                targettableFighters.RemoveAt(i);
            }
        }

        return(targettableFighters);
    }
예제 #6
0
 void Awake()
 {
     singleton = this;
     currCount = startCount;
 }
예제 #7
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("BuddyOnAir(");
        bool __first = true;

        if (Mid != null && __isset.mid)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Mid: ");
            Mid.ToString(sb);
        }
        if (__isset.freshnessLifetime)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("FreshnessLifetime: ");
            FreshnessLifetime.ToString(sb);
        }
        if (OnAirId != null && __isset.onAirId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("OnAirId: ");
            OnAirId.ToString(sb);
        }
        if (__isset.onAir)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("OnAir: ");
            OnAir.ToString(sb);
        }
        if (Text != null && __isset.text)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Text: ");
            Text.ToString(sb);
        }
        if (__isset.viewerCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ViewerCount: ");
            ViewerCount.ToString(sb);
        }
        if (__isset.targetCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("TargetCount: ");
            TargetCount.ToString(sb);
        }
        if (__isset.onAirType)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("OnAirType: ");
            OnAirType.ToString(sb);
        }
        if (OnAirUrls != null && __isset.onAirUrls)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("OnAirUrls: ");
            OnAirUrls.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }