Exemplo n.º 1
0
 private static void appendCourseOfActionAttributes(StringBuilder sb, CourseOfAction courseOfAction)
 {
     sb.AppendLine(
         buildAttributeText(
             "Damage",
             buildDamageText(courseOfAction.GetDamage(), courseOfAction.GetFireRate())));
     sb.AppendLine(buildAttributeText("Range", buildRangeText(courseOfAction.GetRange())));
     sb.AppendLine(buildAttributeText("Fire Rate", buildFireRateText(courseOfAction.GetFireRate())));
 }
Exemplo n.º 2
0
        // TODO This is fairly random, but made so because of missing data in CourseOfAction and to be consistent
        public static int GetValue(this CourseOfAction courseOfAction)
        {
            var categoryValue   = courseOfAction.custom.category == null ? 10 : courseOfAction.custom.category.Length;
            var mitigationValue =
                courseOfAction.custom.mitigation == null ? 15 : courseOfAction.custom.mitigation.Length;
            var referencesValue = courseOfAction.external_references == null ? 20
                : courseOfAction.external_references.Length;

            return(Mathf.RoundToInt((categoryValue + mitigationValue + referencesValue) / 2f / 10f) * 5);
        }
Exemplo n.º 3
0
        // TODO This is fairly random, but made so because of missing data in CourseOfAction and to be consistent
        public static float GetFireRate(this CourseOfAction courseOfAction)
        {
            var categoryValue   = courseOfAction.custom.category == null ? 10f : courseOfAction.custom.category.Length;
            var mitigationValue =
                courseOfAction.custom.mitigation == null ? 15f : courseOfAction.custom.mitigation.Length;
            var referencesValue = courseOfAction.external_references == null ? 20f
                : courseOfAction.external_references.Length;

            return(Mathf.Min(Mathf.Max((categoryValue * 2 - mitigationValue + referencesValue) / 20f, 0f) + 1f, 4f));
        }
Exemplo n.º 4
0
        // TODO This is fairly random, but made so because of missing data in CourseOfAction and to be consistent
        public static float GetRange(this CourseOfAction courseOfAction)
        {
            var categoryValue   = courseOfAction.custom.category == null ? 5f : courseOfAction.custom.category.Length;
            var mitigationValue =
                courseOfAction.custom.mitigation == null ? 19f : courseOfAction.custom.mitigation.Length;
            var referencesValue = courseOfAction.external_references == null ? 30f
                : courseOfAction.external_references.Length;

            return(5 + (categoryValue + mitigationValue * 2 + referencesValue) / 8f);
        }
Exemplo n.º 5
0
        // TODO This is fairly random, but made so because of missing data in CourseOfAction and to be consistent
        public static DamageAttribute GetDamage(this CourseOfAction courseOfAction)
        {
            var categoryValue   = courseOfAction.custom.category == null ? 8f : courseOfAction.custom.category.Length;
            var mitigationValue =
                courseOfAction.custom.mitigation == null ? 5f : courseOfAction.custom.mitigation.Length;
            var referencesValue = courseOfAction.external_references == null ? 25f
                : courseOfAction.external_references.Length;

            var baseDamage = (categoryValue * 2 + mitigationValue + referencesValue / 2f) / 5f;

            return(new DamageAttribute {
                MinimumDamage = (baseDamage - 2) * 0.8f, MaximumDamage = (baseDamage + 4) * 1.1f
            });
        }
Exemplo n.º 6
0
        public void Initialize(
            IPlacementArea area,
            IntVector2 gridPosition,
            IntVector2 sizeOffset,
            CourseOfAction courseOfAction)
        {
            this.courseOfAction = courseOfAction;

            placementArea    = area;
            areaGridPosition = gridPosition;
            areaSizeOffset   = sizeOffset;

            Damage = courseOfAction.GetDamage();
            Range  = courseOfAction.GetRange();
            RangeIndicator.localScale = Vector3.one * Range * 2f;
            FireRate = courseOfAction.GetFireRate();

            // Hover and click actions
            ClickableBehaviour.Title = courseOfAction.custom.mitigation;
            ClickableBehaviour.Text  = Formatter.BuildStixDataEntityDescription(courseOfAction);

            ClickableBehaviour.ActionText    = "select";
            ClickableBehaviour.PrimaryAction = () => {
                SelectionHelper.DeselectAllMitigations();
                IsSelected = true;

                var title           = courseOfAction.custom.mitigation;
                var description     = Formatter.BuildStixDataEntityDescription(courseOfAction, true, false);
                var selectedActions = new SelectedAction[] {
                    new SelectedAction(ActionType.Sell, sell),
                    new SelectedAction(
                        ActionType.OpenExternalReferences,
                        () => ReferencesHelper.OpenExternalReferences(courseOfAction))
                };
                HelperObjects.SelectedInfoBar.SelectEntity(title, "Mitigation", description, selectedActions);
            };
            ClickableBehaviour.HasSecondaryAction =
                ReferencesHelper.AddReferencesAsAction(courseOfAction, ClickableBehaviour);
        }
Exemplo n.º 7
0
        public void Initialize(CourseOfAction courseOfAction)
        {
            Value = courseOfAction.GetValue();

            Label.text = courseOfAction.custom.category;

            ClickableBehaviour.Title = courseOfAction.custom.category;
            ClickableBehaviour.Text  = Formatter.BuildStixDataEntityDescription(courseOfAction);

            ClickableBehaviour.ActionText    = "implement";
            ClickableBehaviour.PrimaryAction = () => {
                // Destroy the old ghost if it's already in the game
                var oldGhost = FindObjectOfType <GhostMitigationBehaviour>();
                if (oldGhost != null)
                {
                    oldGhost.DestroyGhost();
                }

                BuildManager.I.EnterBuildMode(courseOfAction);
                UnityHelper.Instantiate(HelperObjects.GhostMitigationPrefab);
            };
            ClickableBehaviour.HasSecondaryAction = ReferencesHelper.AddReferencesAsAction(courseOfAction, ClickableBehaviour);
        }
Exemplo n.º 8
0
 public void ExitBuildMode()
 {
     GameManager.IsBuilding = false;
     CursorManager.I.ResetCursor();
     currentCourseOfAction = null;
 }
Exemplo n.º 9
0
 public void EnterBuildMode(CourseOfAction courseOfAction)
 {
     GameManager.IsBuilding = true;
     CursorManager.I.SetCursor(CursorType.Target);
     currentCourseOfAction = courseOfAction;
 }