Exemplo n.º 1
0
 private static string buildDamageText(DamageAttribute damage, float fireRate)
 {
     return((string.Format("{0:#0.0}-{1:#0.0}", damage.MinimumDamage, damage.MaximumDamage).PadLeft(10)
             + string.Format(" ({0:##0.0} {1})", damage.GetDamagePerSecond(fireRate), "DPS".Monospaced(2.5f)))
            .Monospaced()
            .Indented(25));
 }
Exemplo n.º 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);
        }