示例#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())));
 }
示例#2
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);
        }