//potected 함수들----------------------------------------------------------------------------------
    //단서 발견 시 이벤트...클릭
    protected void Collect(int num, string name)
    {
        Btns_clue[num - 1].GetComponent <Image>().sprite = Sprites_clue[num];
        Activation[num - 1] = true;
        particles_clue_object[num - 1].Play();

        SoundManager.Instance.Play_effect(1);
        if (Disappear_Clue[num - 1])
        {
            target.SetActive(false);
        }
        AC.Advice(name);

        //모든 단서를 찾았다면
        if (Activation[0] && Activation[1] && Activation[2])
        {
            //초기화
            for (int i = 0; i < 3; i++)
            {
                Activation[i] = false;
            }

            //다음 명령 내리기
            AC.Dialog_and_Advice("play1");

            //드래그해야할 단서 표시하기
            Effect_clue(particles_clue_btn[0]);

            //잠금 해제
            Enable_drag(true);
        }
    }
Exemple #2
0
 public void ClickOutput(AC.Menu _menu, MouseState _mouseState)
 {
     if (items.Count > 0)
     {
         if (_mouseState == MouseState.SingleClick)
         {
             if (KickStarter.runtimeInventory.selectedItem == null)
             {
                 // Pick up created item
                 if (activeRecipe.onCreateRecipe == OnCreateRecipe.SelectItem)
                 {
                     KickStarter.runtimeInventory.PerformCrafting (activeRecipe, true);
                 }
                 else if (activeRecipe.onCreateRecipe == OnCreateRecipe.RunActionList)
                 {
                     KickStarter.runtimeInventory.PerformCrafting (activeRecipe, false);
                     if (activeRecipe.invActionList != null)
                     {
                         AdvGame.RunActionListAsset (activeRecipe.invActionList);
                     }
                 }
                 else
                 {
                     KickStarter.runtimeInventory.PerformCrafting (activeRecipe, false);
                 }
             }
         }
         PlayerMenus.ResetInventoryBoxes ();
     }
 }
Exemple #3
0
        public void When_LowpassRLSmallSignal_Expect_Reference()
        {
            /*
             * Lowpass RL filter in the frequency domain should have a single pole at s=-2pi*R/L
             */
            // Create circuit
            double resistance = 1;
            var    inductance = 1e-3;
            var    ckt        = new Circuit(
                new VoltageSource("V1", "IN", "0", 0.0)
                .SetParameter("acmag", 1.0),
                new Inductor("L1", "IN", "OUT", inductance),
                new Resistor("R1", "OUT", "0", resistance));

            // Create simulation
            var ac = new AC("ac", new DecadeSweep(0.1, 1e6, 10));

            // Create exports
            var exports = new IExport <Complex> [1];

            exports[0] = new ComplexVoltageExport(ac, "OUT");

            // Create references
            Func <double, Complex>[] references = { f => 1.0 / new Complex(1.0, inductance / resistance * 2 * Math.PI * f) };

            // Run test
            AnalyzeAC(ac, ckt, exports, references);
            DestroyExports(exports);
        }
Exemple #4
0
        public override AuxiliaryLineParameter GetNewAuxiliaryLineParameterBaseWidth(int changeSizeWidth, int changeSizeHeight)
        {
            AuxiliaryLineParameter newParameter = AC.CloneParameter();

            // 右下点の操作なら左側や上側は変わらない
            int changeWidth  = changeSizeWidth;
            int changeHeight = changeSizeHeight;
            int newRight     = AC.AuxiliaryRight + changeWidth;
            int newBottom    = AC.AuxiliaryBottom + CalcHeightChangeSize(changeWidth, changeHeight);
            int maxRight     = GetMaxRight();
            int maxBottom    = GetMaxBottom();

            if (newRight > maxRight)
            {
                newBottom = AC.AuxiliaryBottom + CalcHeightChangeSize(newRight - maxRight, changeHeight);
                newRight  = maxRight;
            }
            if (newBottom > maxBottom)
            {
                changeHeight = maxBottom - AC.AuxiliaryBottom;
                newRight     = AC.AuxiliaryRight + CalcWidthChangeSize(changeWidth, changeHeight);
                newBottom    = maxBottom;
            }

            SetNewParameter(newParameter, newRight - AC.AuxiliaryRight, newBottom - AC.AuxiliaryBottom);
            return(newParameter);
        }
Exemple #5
0
        public void When_DelayFrequency_Expect_Reference()
        {
            var delay = 1e-6;

            // Build the circuit
            var ckt = new Circuit(
                new VoltageSource("V1", "in", "0", 1.0)
                .SetParameter("acmag", 1.0),
                new VoltageDelay("Delay1", "out", "0", "in", "0", delay));

            // Build the analysis
            var ac      = new AC("ac", new DecadeSweep(1e-3, 1e5, 5));
            var exports = new Export <Complex>[]
            {
                new ComplexVoltageExport(ac, "out")
            };
            var references = new Func <double, Complex>[]
            {
                frequency => Complex.Exp(-ac.ComplexState.Laplace * delay)
            };

            // Analyze the AC behavior
            AnalyzeAC(ac, ckt, exports, references);
            DestroyExports(exports);
        }
 void magnifier_Magnify(object sender, AC.AvalonControlsLibrary.Controls.MagnifyEventArgs e)
 {
     displayValue.Text = e.MagnifiedBy.ToString();
     //as you can not depending on how much you try to magnify the speed of the magnification changes
     //P.S the * 20 is there since we have a very small value for minimum and maximum
     displayRect.Width = Math.Max(displayRect.Width - (e.MagnifiedBy * 20), 0);
 }
 public static void DeleteAction(AC.Action action, ActionListAsset _target)
 {
     _target.actions.Remove (action);
     Undo.DestroyObjectImmediate (action);
     //UnityEngine.Object.DestroyImmediate (_action, true);
     AssetDatabase.SaveAssets ();
 }
// AI Method End
    public void ClearDZ(int Mode)
    {
        for (int i = 0; i < hands.Count; i++)
        {
            if (Mode == 1)
            {
                foreach (AmourCard AC in dzones[i].SpecificUseCards)
                {
                    AC.GetComponent <Dragable>().returnParent = Discard.transform;
                    AC.transform.SetParent(Discard.transform);
                    AC.gameObject.GetComponent <Image>().sprite = AC.GetComponent <AdventureCard>().cardBack;
                    Discard.cards.Add(AC);
                }
                dzones[i].SpecificUseCards.Clear();
            }
            foreach (EquipmentCard EC in dzones[i].Equipment)
            {
                EC.GetComponent <Dragable>().returnParent = Discard.transform;
                EC.transform.SetParent(Discard.transform);
                EC.gameObject.GetComponent <Image>().sprite = EC.GetComponent <AdventureCard>().cardBack;
                Discard.cards.Add(EC);
            }
            dzones[i].Equipment.Clear();
        }
    }
Exemple #9
0
        protected void SharedGUITwo(AC.Char _target)
        {
            EditorGUILayout.BeginVertical ("Button");
            EditorGUILayout.LabelField ("Rigidbody settings:", EditorStyles.boldLabel);
            _target.ignoreGravity = EditorGUILayout.Toggle ("Ignore gravity?", _target.ignoreGravity);
            _target.freezeRigidbodyWhenIdle = EditorGUILayout.Toggle ("Freeze when Idle?", _target.freezeRigidbodyWhenIdle);
            EditorGUILayout.EndVertical ();

            EditorGUILayout.BeginVertical ("Button");
            EditorGUILayout.LabelField ("Audio clips:", EditorStyles.boldLabel);

            _target.walkSound = (AudioClip) EditorGUILayout.ObjectField ("Walk sound:", _target.walkSound, typeof (AudioClip), false);
            _target.runSound = (AudioClip) EditorGUILayout.ObjectField ("Run sound:", _target.runSound, typeof (AudioClip), false);
            if (AdvGame.GetReferences ().speechManager != null && AdvGame.GetReferences ().speechManager.scrollSubtitles)
            {
                _target.textScrollClip = (AudioClip) EditorGUILayout.ObjectField ("Text scroll override:", _target.textScrollClip, typeof (AudioClip), false);
            }
            _target.soundChild = (Sound) EditorGUILayout.ObjectField ("Sound child:", _target.soundChild, typeof (Sound), true);
            EditorGUILayout.EndVertical ();

            EditorGUILayout.BeginVertical ("Button");
            EditorGUILayout.LabelField ("Dialogue settings:", EditorStyles.boldLabel);

            EditorGUILayout.LabelField ("Portrait graphic:");
            _target.portraitIcon.ShowGUI (false);
            _target.speechColor = EditorGUILayout.ColorField ("Speech text colour:", _target.speechColor);
            _target.speechLabel = EditorGUILayout.TextField ("Speaker label:", _target.speechLabel);
            EditorGUILayout.EndVertical ();
        }
	public override void Declare (AC.Char _character)
	{
		character = _character;
		turningIsLinear = true;
		rootMotion = false;
		isSpriteBased = true;
	}
Exemple #11
0
 //clears drop zones between stages
 //allies remain from stage to stage
 // pass in a 1 it clears everything, pass in 0 it only clears equipment
 public void ClearDropZones(int Mode)
 {
     for (int i = 0; i < dzones.Count; i++)
     {
         if (Mode == 1)
         {
             foreach (AmourCard AC in dzones[i].SpecificUseCards)
             {
                 AC.GetComponent <Dragable>().returnParent = Discard.transform;
                 AC.transform.SetParent(Discard.transform);
                 AC.gameObject.GetComponent <Image>().sprite = AC.GetComponent <AdventureCard>().cardBack;
                 Discard.cards.Add(AC);
             }
             dzones[i].SpecificUseCards.Clear();
         }
         foreach (EquipmentCard EC in dzones[i].Equipment)
         {
             EC.GetComponent <Dragable>().returnParent = Discard.transform;
             EC.transform.SetParent(Discard.transform);
             EC.gameObject.GetComponent <Image>().sprite = EC.GetComponent <AdventureCard>().cardBack;
             Discard.cards.Add(EC);
         }
         dzones[i].Equipment.Clear();
         HandleTextFile.WriteLog((Controler.LogLine += 1) + " Clearing cards from Dropzone of player" + (i + 1) + " #BNF-19", Controler.SName);
     }
 }
Exemple #12
0
        public override AuxiliaryLineParameter GetNewAuxiliaryLineParameterBaseHeight(int changeSizeWidth, int changeSizeHeight)
        {
            AuxiliaryLineParameter newParameter = AC.CloneParameter();

            // 左下点の操作なら右側と上側は変わらない
            int changeWidth  = changeSizeWidth;
            int changeHeight = changeSizeHeight;
            int newLeft      = AC.AuxiliaryLeft - CalcWidthChangeSize(changeSizeWidth, changeSizeHeight);
            int newBottom    = AC.AuxiliaryBottom + changeSizeHeight;
            int minLeft      = GetMinLeft();
            int maxBottom    = GetMaxBottom();

            if (newBottom > maxBottom)
            {
                changeHeight = maxBottom - AC.AuxiliaryBottom;
                newLeft      = AC.AuxiliaryLeft - CalcWidthChangeSize(changeWidth, changeHeight);
                newBottom    = maxBottom;
            }
            if (newLeft < minLeft)
            {
                newLeft   = minLeft;
                newBottom = AC.AuxiliaryBottom + CalcHeightChangeSize(AC.AuxiliaryLeft - newLeft, changeHeight);
            }

            newParameter.ReplacePoint(new Point(newLeft, AC.AuxiliaryTop),
                                      new Point(newLeft, newBottom),
                                      new Point(AC.AuxiliaryRight, AC.AuxiliaryTop),
                                      new Point(AC.AuxiliaryRight, newBottom));

            return(newParameter);
        }
	public virtual void Declare (AC.Char _character)
	{
		character = _character;
		turningIsLinear = false;
		rootMotion = false;
		isSpriteBased = false;
	}
        public override AuxiliaryLineParameter ExecuteCore(object operation = null)
        {
            Point leftTop     = AC.AuxiliaryLeftTop;
            Point leftBottom  = AC.AuxiliaryLeftBottom;
            Point rightTop    = AC.AuxiliaryRightTop;
            Point rightBottom = AC.AuxiliaryRightBottom;
            int   centerX     = Common.CalcCenterX(leftTop, rightBottom);
            int   centerY     = Common.CalcCenterY(leftBottom, rightTop);

            Point newLeftTop     = CalcRotatePoint(leftTop, centerX, centerY, Degree);
            Point newLeftBottom  = CalcRotatePoint(leftBottom, centerX, centerY, Degree);
            Point newRightTop    = CalcRotatePoint(rightTop, centerX, centerY, Degree);
            Point newRightBottom = CalcRotatePoint(rightBottom, centerX, centerY, Degree);

            // degreeの通りに回転したら画像からはみ出る場合に回転しない
            if (IsOutOfRangeDisplayImage(newLeftTop) ||
                IsOutOfRangeDisplayImage(newLeftBottom) ||
                IsOutOfRangeDisplayImage(newRightTop) ||
                IsOutOfRangeDisplayImage(newRightBottom))
            {
                return(AC.CloneParameter());
            }

            AuxiliaryLineParameter newParameter = AC.CloneParameter();

            newParameter.ReplaceParameter(newLeftTop,
                                          newLeftBottom,
                                          newRightTop,
                                          newRightBottom,
                                          newParameter.Degree + Degree);

            return(newParameter);
        }
Exemple #15
0
        /// <summary>
        /// Perform a test for AC analysis
        /// </summary>
        /// <param name="sim">Simulation</param>
        /// <param name="ckt">Circuit</param>
        /// <param name="exports">Exports</param>
        /// <param name="references">References</param>
        protected void AnalyzeAC(AC sim, Circuit ckt, IEnumerable <IExport <Complex> > exports, IEnumerable <Func <double, Complex> > references)
        {
            sim.ExportSimulationData += (sender, data) =>
            {
                using var exportsIt    = exports.GetEnumerator();
                using var referencesIt = references.GetEnumerator();
                while (exportsIt.MoveNext() && referencesIt.MoveNext())
                {
                    // Test export
                    var actual   = exportsIt.Current?.Value ?? throw new ArgumentNullException();
                    var expected = referencesIt.Current?.Invoke(data.Frequency) ?? throw new ArgumentNullException();

                    // Test real part
                    var rtol = Math.Max(Math.Abs(actual.Real), Math.Abs(expected.Real)) * RelTol + AbsTol;
                    var itol = Math.Max(Math.Abs(actual.Imaginary), Math.Abs(expected.Imaginary)) * RelTol +
                               AbsTol;

                    try
                    {
                        Assert.AreEqual(expected.Real, actual.Real, rtol);
                        Assert.AreEqual(expected.Imaginary, actual.Imaginary, itol);
                    }
                    catch (Exception ex)
                    {
                        var msg = $"{ex.Message} at {data.Frequency} Hz";
                        throw new Exception(msg, ex);
                    }
                }
            };
            sim.Run(ckt);
        }
Exemple #16
0
    IEnumerator Game2()
    {
        AC.Dialog_and_Advice("play2");
        yield return(wait);

        GameEnd(1);
    }
        public override AuxiliaryLineParameter GetNewAuxiliaryLineParameterBaseHeight(int changeSizeWidth, int changeSizeHeight)
        {
            AuxiliaryLineParameter newParameter = AC.CloneParameter();

            // 左上点の操作なら右側や下側は変わらない
            int changeWidth  = changeSizeWidth;
            int changeHeight = changeSizeHeight;
            int newLeft      = AC.AuxiliaryLeft - CalcWidthChangeSize(changeSizeWidth, changeSizeHeight);
            int newTop       = AC.AuxiliaryTop - changeSizeHeight;
            int minLeft      = GetMinLeft();
            int minTop       = GetMinTop();

            if (newTop < minTop)
            {
                changeHeight = AC.AuxiliaryTop - minTop;
                newLeft      = AC.AuxiliaryLeft - CalcWidthChangeSize(changeWidth, changeHeight);
                newTop       = minTop;
            }
            if (newLeft < minLeft)
            {
                newLeft = minLeft;
                newTop  = AC.AuxiliaryTop - CalcHeightChangeSize(AC.AuxiliaryLeft - newLeft, changeHeight);
            }

            newParameter.ReplacePoint(new Point(newLeft, newTop),
                                      new Point(newLeft, AC.AuxiliaryBottom),
                                      new Point(AC.AuxiliaryRight, newTop),
                                      new Point(AC.AuxiliaryRight, AC.AuxiliaryBottom));
            return(newParameter);
        }
Exemple #18
0
        public void When_Capacitor_LowpassRCSmallSignal_Expect_Reference()
        {
            /*
             * Lowpass RC filter in the frequency domain should have a single pole at s=-2pi*R*C
             */
            // Create circuit
            var resistance  = 1e3;
            var capacitance = 1e-6;
            var ckt         = new Circuit(
                new VoltageSource("V1", "IN", "0", 0.0)
                .SetParameter("acmag", 1.0),
                new Resistor("R1", "IN", "OUT", resistance),
                new Capacitor("C1", "OUT", "0", capacitance)
                );

            // Create simulation
            var ac = new AC("ac", new DecadeSweep(0.1, 1.0e6, 10));

            // Create exports
            Export <Complex>[] exports = { new ComplexPropertyExport(ac, "C1", "v") };

            // Create references
            Func <double, Complex>[] references = { f => 1.0 / new Complex(1.0, resistance * capacitance * 2 * Math.PI * f) };

            // Run test
            AnalyzeAC(ac, ckt, exports, references);
            DestroyExports(exports);
        }
Exemple #19
0
        public void When_DiodeSmallSignal_Expect_Spice3f5Reference()
        {
            /*
             * DC voltage source shunted by a diode
             * Current is expected to behave like the reference
             */
            // Build circuit
            var ckt = new Circuit();

            ckt.Add(
                CreateDiode("D1", "0", "OUT", "1N914"),
                CreateDiodeModel("1N914", "Is=2.52e-9 Rs=0.568 N=1.752 Cjo=4e-12 M=0.4 tt=20e-9"),
                new VoltageSource("V1", "OUT", "0", 1.0)
                );
            ckt["V1"].SetParameter("acmag", 1.0);

            // Create simulation
            var ac = new AC("ac", new DecadeSweep(1e3, 10e6, 5));

            // Create exports
            Export <Complex>[] exports = { new ComplexPropertyExport(ac, "V1", "i") };

            // Create references
            double[]    riRef      = { -1.945791742986885e-12, -1.904705637099517e-08, -1.946103289747125e-12, -3.018754997881332e-08, -1.946885859826953e-12, -4.784404245850086e-08, -1.948851586992178e-12, -7.582769719229839e-08, -1.953789270386556e-12, -1.201788010800761e-07, -1.966192170307985e-12, -1.904705637099495e-07, -1.997346846331992e-12, -3.018754997881245e-07, -2.075603854314768e-12, -4.784404245849736e-07, -2.272176570837208e-12, -7.582769719228451e-07, -2.765944910274710e-12, -1.201788010800207e-06, -4.006234902415568e-12, -1.904705637097290e-06, -7.121702504803603e-12, -3.018754997872460e-06, -1.494740330300116e-11, -4.784404245814758e-06, -3.460467495474045e-11, -7.582769719089195e-06, -8.398150889530617e-11, -1.201788010744768e-05, -2.080105080892987e-10, -1.904705636876583e-05, -5.195572682013223e-10, -3.018754996993812e-05, -1.302127347221150e-09, -4.784404242316795e-05, -3.267854507347871e-09, -7.582769705163549e-05, -8.205537869558709e-09, -1.201788005200868e-04, -2.060843758802494e-08, -1.904705614805916e-04 };
            Complex[][] references = new Complex[1][];
            references[0] = new Complex[riRef.Length / 2];
            for (int i = 0; i < riRef.Length; i += 2)
            {
                references[0][i / 2] = new Complex(riRef[i], riRef[i + 1]);
            }

            // Run test
            AnalyzeAC(ac, ckt, exports, references);
        }
Exemple #20
0
    //코루틴 -----------------------------------------------------------------------------------
    IEnumerator Game1(bool start)
    {
        if (start)
        {
            AC.Dialog_and_Advice("play1_1");
        }
        else
        {
            AC.Dialog_and_Advice("play1_2");
        }

        yield return(wait);

        blank.SetActive(start);

        if (start)
        {
            cmr.cullingMask = 1536;
            play            = false;
        }
        else
        {
            cmr.cullingMask = -1;
            GameEnd(0);
        }
    }
Exemple #21
0
 public virtual void CollectResources(IList <ResourcePtr> ResourceCollector)
 {
     foreach (IHasResources AC in AllComponents.Where(x => x is IHasResources))
     {
         AC.CollectResources(ResourceCollector);
     }
 }
Exemple #22
0
        public void When_RCFilterAC_Expect_NoException()
        {
            // <example_AC>
            // Build the circuit
            var ckt = new Circuit(
                new VoltageSource("V1", "in", "0", 0.0)
                .SetParameter("acmag", 1.0),
                new Resistor("R1", "in", "out", 10.0e3),
                new Capacitor("C1", "out", "0", 1e-6)
                );

            // Create the simulation
            var ac = new AC("AC 1", new DecadeSweep(1e-2, 1.0e3, 5));

            // Make the export
            var exportVoltage = new ComplexVoltageExport(ac, "out");

            // Simulate
            ac.ExportSimulationData += (sender, args) =>
            {
                var output   = exportVoltage.Value;
                var decibels = 10.0 * Math.Log10(output.Real * output.Real + output.Imaginary * output.Imaginary);
            };
            ac.Run(ckt);
            // </example_AC>
        }
Exemple #23
0
        /// <summary>
        /// Perform a test for AC analysis
        /// </summary>
        /// <param name="sim">Simulation</param>
        /// <param name="ckt">Circuit</param>
        /// <param name="exports">Exports</param>
        /// <param name="references">References</param>
        protected void AnalyzeAC(AC sim, Circuit ckt, IEnumerable <IExport <double> > exports, IEnumerable <double[]> references)
        {
            var index = 0;

            sim.ExportSimulationData += (sender, data) =>
            {
                using var exportsIt    = exports.GetEnumerator();
                using var referencesIt = references.GetEnumerator();
                while (exportsIt.MoveNext() && referencesIt.MoveNext())
                {
                    // Test export
                    var actual   = exportsIt.Current?.Value ?? throw new ArgumentNullException();
                    var expected = referencesIt.Current?[index] ?? throw new ArgumentNullException();
                    var tol      = Math.Max(Math.Abs(actual), Math.Abs(expected)) * RelTol + AbsTol;

                    try
                    {
                        Assert.AreEqual(expected, actual, tol);
                    }
                    catch (Exception ex)
                    {
                        var msg = $"{ex.Message} at {data.Frequency} Hz";
                        throw new Exception(msg, ex);
                    }
                }

                index++;
            };
            sim.Run(ckt);
        }
Exemple #24
0
        public QRDialog(AC.Pattern pattern)
        {
            this.pattern = pattern;
            qrImage = CreateQRCode(pattern, 3);

            InitializeComponent();
        }
Exemple #25
0
        public void When_ACRerun_Expect_Same()
        {
            // Create the circuit
            var ckt = new Circuit(
                new VoltageSource("V1", "in", "0", 10.0).SetParameter("acmag", 1.0),
                new Resistor("R1", "in", "out", 10),
                new Capacitor("C1", "out", "0", 20)
                );

            // Create the transient analysis
            var ac     = new AC("ac 1", new DecadeSweep(1, 1e9, 10));
            var export = new ComplexVoltageExport(ac, "out");

            // Run the simulation a first time for building the reference values
            var r = new List <Complex>();

            void BuildReference(object sender, ExportDataEventArgs args) => r.Add(export.Value);

            ac.ExportSimulationData += BuildReference;
            ac.Run(ckt);
            ac.ExportSimulationData -= BuildReference;

            // Rerun the simulation for building the reference values
            var index = 0;

            void CheckReference(object sender, ExportDataEventArgs args)
            {
                Assert.AreEqual(r[index].Real, export.Value.Real, 1e-20);
                Assert.AreEqual(r[index++].Imaginary, export.Value.Imaginary, 1e-20);
            }

            ac.ExportSimulationData += CheckReference;
            ac.Rerun();
            ac.ExportSimulationData -= CheckReference;
        }
Exemple #26
0
 private void CheckScreenSize(AC.Menu menu)
 {
     if (screenSize.x != Screen.width || screenSize.y != Screen.height)
     {
         screenSize = new Vector2 (Screen.width, Screen.height);
         menu.Recalculate ();
     }
 }
Exemple #27
0
        protected override void SaveClick(object sender, EventArgs e)
        {
            base.SaveClick(sender, e);
            base.ReturnPanelClick(sender, e);
            Dispose();

            AC.AddNewConnectionsAsync(_connectionDefinition, _starTimePicker.Value, _toTimePicker.Value, _days, _hourTimePicker.Value.Hour, _minDateTimePicker.Value.Minute);
        }
    public static void Main(string[] args)
    {
        //Application.EnableVisualStyles();
        //Application.SetCompatibleTextRenderingDefault(false);
        AC ac = new AC();

        Application.Run(ac);
    }
        public static AccessControl GetAccessControlObject(string controlLevel)
        {
            CreateACObjects().TryGetValue(controlLevel, out AccessControl AC);



            return(AC.Clone());
        }
Exemple #30
0
 private void ReplantSeed()
 {
     AC.SetBool("isMoving", false);
     ResetGhosts();
     AnimateGhosts();
     PC.SwitchToGhost(currSeed.ghost, currSeed.ghost.AC, currSeed.ghost.CC);
     GM.StartRecording(currSeed.ghost);
 }
    //선크림 이벤트 진행 (대화로만)
    IEnumerator Game3()
    {
        AC.Dialog_and_Advice("play3");

        yield return(wait);

        GameEnd(2);
    }
Exemple #32
0
        public bool IsRight()
        {
            // Вычисление квадратов отрезков
            double abSquare = Math.Pow(AB.GetLength(), 2);
            double acSquare = Math.Pow(AC.GetLength(), 2);
            double bcSquare = Math.Pow(BC.GetLength(), 2);

            return((abSquare.ApproximateCompareTo(acSquare + bcSquare, 0.2)) || (acSquare.ApproximateCompareTo(abSquare + bcSquare, 0.2)) || (bcSquare.ApproximateCompareTo(acSquare + abSquare, 0.2)));
        }
Exemple #33
0
 protected override void SaveClick(object sender, EventArgs e)
 {
     AC.AddNewConnection(_departureStation, _arrivalStation, _hourTimePicker.Value.Hour,
                         _minutesTimePicker.Value.Minute, _price, _departureStation.Name + " " + _arrivalStation.Name);
     {
         base.SaveClick(sender, e);
         base.ReturnButton.PerformClick();
     }
 }
    //물고기 이벤트 시작
    IEnumerator Game2()
    {
        blank_R1.GetComponent <RawImage>().texture = blank_fish;
        AC.Dialog_and_Advice("play2");

        yield return(wait);

        blank.SetActive(true);
    }
    //물고기 돋보기 이벤트 후 진행
    IEnumerator Game2_1()
    {
        AC.Dialog_and_Advice("play2_2");

        yield return(wait);

        blank.SetActive(false);
        GameEnd(1);
    }
Exemple #36
0
 private void Login_Form_Load(object sender, EventArgs e)
 {
     MaximizeBox           = false;
     buttonLogin.BackColor = Color.FromArgb(191, 205, 219);
     buttonExit.BackColor  = Color.FromArgb(191, 205, 219);
     BackColor             = Color.FromArgb(215, 228, 242);
     pictureBoxHeader2.Controls.Add(pictureBoxHeader1); //ピクチャーボックスの背景を透過させる(プロパティ:BackColorがTransparentになっていること)
     AC.openConnection();
 }
Exemple #37
0
        private AC CreateAcSimulation(string name, Control statement, ICircuitContext context)
        {
            switch (statement.Parameters.Count)
            {
            case 0:
                context.Result.Validation.Add(new ValidationEntry(ValidationEntrySource.Reader, ValidationEntryLevel.Warning, "LIN, DEC or OCT expected", statement.LineInfo));
                return(null);

            case 1:
                context.Result.Validation.Add(new ValidationEntry(ValidationEntrySource.Reader, ValidationEntryLevel.Warning, "Number of points expected", statement.LineInfo));
                return(null);

            case 2:
                context.Result.Validation.Add(new ValidationEntry(ValidationEntrySource.Reader, ValidationEntryLevel.Warning, "Starting frequency expected", statement.LineInfo));
                return(null);

            case 3:
                context.Result.Validation.Add(new ValidationEntry(ValidationEntrySource.Reader, ValidationEntryLevel.Warning, "Stopping frequency expected", statement.LineInfo));
                return(null);
            }

            AC ac;

            string type        = statement.Parameters.Get(0).Image.ToLower();
            var    numberSteps = context.Evaluator.EvaluateDouble(statement.Parameters.Get(1));
            var    start       = context.Evaluator.EvaluateDouble(statement.Parameters.Get(2));
            var    stop        = context.Evaluator.EvaluateDouble(statement.Parameters.Get(3));

            switch (type)
            {
            case "lin": ac = new AC(name, new LinearSweep(start, stop, (int)numberSteps)); break;

            case "oct": ac = new AC(name, new OctaveSweep(start, stop, (int)numberSteps)); break;

            case "dec": ac = new AC(name, new DecadeSweep(start, stop, (int)numberSteps)); break;

            default:
                context.Result.Validation.Add(new ValidationEntry(ValidationEntrySource.Reader, ValidationEntryLevel.Warning, "LIN, DEC or OCT expected", statement.LineInfo));
                return(null);
            }

            ConfigureCommonSettings(ac, context);
            ConfigureAcSettings(ac.FrequencyParameters, context);

            /*ac.BeforeFrequencyLoad += (sender, args) =>
             *  {
             *      if (ac.ComplexState != null)
             *      {
             *          var freq = ac.ComplexState.Laplace.Imaginary / (2.0 * Math.PI);
             *          context.Evaluator.SetParameter(ac, "FREQ", freq);
             *      }
             *  };*/

            // TODO
            context.Result.AddSimulation(ac);
            return(ac);
        }
    //Overriding-----------------------------------------------------------------------------------
    protected override void SetObjectEvent(string name)
    {
        switch (name)
        {
        case "Npc3_1":
            if (play)
            {
                if (Btns_clue[0].interactable)
                {
                    StartCoroutine(Game1(true));
                }
                else
                {
                    AC.Advice("다른 콜록이입니다!");
                }
            }
            break;

        case "Npc3_2":
            if (play)
            {
                if (Btns_clue[1].interactable)
                {
                    StartCoroutine(Game2());
                }
                else
                {
                    AC.Advice("다른 콜록이입니다!");
                }
            }
            break;

        case "Npc3_3":
            if (play)
            {
                if (Btns_clue[2].interactable)
                {
                    AC.Dialog_and_Advice("play3");
                }
                else
                {
                    AC.Advice("다른 콜록이입니다!");
                }
            }
            break;

        case "Car_red":
            if (!play && Btns_clue[0].interactable)
            {
                car_red.SetActive(false);
                particles_clue_object[0].Play();
                StartCoroutine(Game1(false));
            }
            break;
        }
    }
Exemple #39
0
        public void Setup(AC.Menu _menu, MenuElement _element, int _slot)
        {
            if (_menu == null)
            {
                return;
            }

            menu = _menu;
            menuElement = _element;
            slot = _slot;
        }
        private void RangeSlider_RangeSelectionChanged(object sender, AC.AvalonControlsLibrary.Controls.RangeSelectionChangedEventArgs e)
        {
            if (e.NewRangeStart > e.NewRangeStop)
            {
                chnSlider.RangeStartSelected = e.NewRangeStop;
                chnSlider.RangeStopSelected = e.NewRangeStart;
            }

            if (lc != null)
            {
                lc.Content = chnSlider.RangeStartSelected.ToString();
                hc.Content = chnSlider.RangeStopSelected.ToString();
            }
        }
        public override Vector3[] GetPointsArray(Vector3 startPosition, Vector3 targetPosition, AC.Char _char = null)
        {
            NavMeshHit hit = new NavMeshHit();
            NavMeshPath _path = new NavMeshPath();

            if (!NavMesh.CalculatePath (startPosition, targetPosition, -1, _path))
            {
                // Could not find path with current vectors
                float maxDistance = 0.001f;

                for (maxDistance = 0.001f; maxDistance < 1f; maxDistance += 0.05f)
                {
                    if (NavMesh.SamplePosition (startPosition, out hit, maxDistance, -1))
                    {
                        startPosition = hit.position;
                        break;
                    }
                }

                for (maxDistance = 0.001f; maxDistance < 1f; maxDistance += 0.05f)
                {
                    if (NavMesh.SamplePosition (targetPosition, out hit, maxDistance, -1))
                    {
                        targetPosition = hit.position;
                        break;
                    }
                }

                NavMesh.CalculatePath (startPosition, targetPosition, -1, _path);
            }

            List<Vector3> pointArray = new List<Vector3>();
            foreach (Vector3 corner in _path.corners)
            {
                pointArray.Add (corner);
            }
            if (pointArray.Count > 1 && pointArray[0].x == startPosition.x && pointArray[0].z == startPosition.z)
            {
                pointArray.RemoveAt (0);
            }
            else if (pointArray.Count == 0)
            {
                pointArray.Clear ();
                pointArray.Add (targetPosition);
            }

            return (pointArray.ToArray ());
        }
		private void ChangeButton (AC.Button button)
		{
			if (button == null)
			{
				return;
			}

			if (changeType == ChangeType.Enable)
			{
				button.isDisabled = false;
			}
			else if (changeType == ChangeType.Disable)
			{
				button.isDisabled = true;
			}
		}
        public static void OnMenuEnable(AC.Menu _menu)
        {
            // This function is called whenever a menu is enabled.

            if (_menu.title == "Pause")
            {
                MenuElement saveButton = _menu.GetElementWithName ("SaveButton");

                if (saveButton)
                {
                    saveButton.isVisible = !PlayerMenus.IsSavingLocked ();
                }

                _menu.Recalculate ();
            }
        }
Exemple #44
0
        private void AddElement(string className, AC.Menu _menu)
        {
            Undo.RecordObject (_menu, "Add element");

            List<int> idArray = new List<int>();

            foreach (MenuElement _element in _menu.elements)
            {
                if (_element != null)
                {
                    idArray.Add (_element.ID);
                }
            }
            idArray.Sort ();

            className = "Menu" + className;
            MenuElement newElement = (MenuElement) CreateInstance (className);
            newElement.Declare ();
            newElement.title = className.Substring (4);

            // Update id based on array
            foreach (int _id in idArray.ToArray())
            {
                if (newElement.ID == _id)
                {
                    newElement.ID ++;
                }
            }

            _menu.elements.Add (newElement);
            if (!Application.isPlaying)
            {
                _menu.Recalculate ();
            }
            DeactivateAllElements (_menu);
            newElement.isEditing = true;
            selectedMenuElement = newElement;

            newElement.hideFlags = HideFlags.HideInHierarchy;
            AssetDatabase.AddObjectToAsset (newElement, this);
            AssetDatabase.ImportAsset (AssetDatabase.GetAssetPath (newElement));
            AssetDatabase.SaveAssets ();

            CleanUpAsset ();
        }
        public override Vector3[] GetPointsArray(AC.Char _char, Vector3 _originPos, Vector3 _targetPos)
        {
            PolygonCollider2D poly = KickStarter.sceneSettings.navMesh.transform.GetComponent <PolygonCollider2D>();
            bool changesMade = KickStarter.sceneSettings.navMesh.AddCharHoles (_char);

            List<Vector3> pointsList3D = new List<Vector3> ();
            if (IsLineClear (_originPos, _targetPos))
            {
                pointsList3D.Add (_targetPos);
                //ResetHoles (KickStarter.sceneSettings.navMesh, changesMade);
                return pointsList3D.ToArray ();
            }

            Vector2[] pointsList = CreateVertexArray (poly);

            Vector2 originPos = GetNearestToMesh (_originPos, poly);
            Vector2 targetPos = GetNearestToMesh (_targetPos, poly);

            pointsList = AddEndsToList (pointsList, originPos, targetPos);

            float[,] weight = pointsToWeight (pointsList);

            int[] precede = buildSpanningTree (0, 1, weight);
            if (precede == null)
            {
                Debug.LogWarning ("Pathfinding error");
                pointsList3D.Add (_targetPos);
                return pointsList3D.ToArray ();
            }
            int[] _path = getShortestPath (0, 1, precede);

            foreach (int i in _path)
            {
                Vector3 vertex = new Vector3 (pointsList[i].x, pointsList[i].y, _originPos.z);
                pointsList3D.Insert (0, vertex);
            }

            if (pointsList3D[0] == _originPos || (pointsList3D[0].x == originPos.x && pointsList3D[0].y == originPos.y))
            {
                pointsList3D.RemoveAt (0);	// Remove origin point from start
            }

            ResetHoles (KickStarter.sceneSettings.navMesh, changesMade);
            return pointsList3D.ToArray ();
        }
 /*
  * <summary>Plays a FaceFX animation on a character, based on an AudioClip.</summary>
  * <param name = "speaker">The speaking character</param>
  * <param name = "name">The unique identifier of the line in the format Joe13, where 'Joe' is the name of the character, and '13' is the ID number of ths speech line</param>
  * <param name = "audioClip">The speech AudioClip</param>
  */
 public static void Play(AC.Char speaker, string name, AudioClip audioClip)
 {
     #if FaceFXIsPresent
     FaceFXControllerScript_Base fcs = speaker.GetComponent <FaceFXControllerScript_Base>();
     if (fcs == null)
     {
         fcs = speaker.GetComponentInChildren <FaceFXControllerScript_Base>();
     }
     if (fcs != null)
     {
         speaker.isLipSyncing = true;
         fcs.PlayAnim ("Default_" + name, audioClip);
     }
     else
     {
         Debug.LogError ("No FaceFXControllerScript_Base script found on " + speaker.gameObject.name);
     }
     #else
     Debug.LogError ("The 'FaceFXIsPresent' preprocessor define must be declared in the Player Settings.");
     #endif
 }
Exemple #47
0
        protected void SharedGUIOne(AC.Char _target)
        {
            if (_target.animEngine == null || !_target.animEngine.ToString ().Contains (_target.animationEngine.ToString ()))
            {
                _target.ResetAnimationEngine ();
            }

            EditorGUILayout.BeginVertical ("Button");
                EditorGUILayout.LabelField ("Animation settings:", EditorStyles.boldLabel);
                _target.animationEngine = (AnimationEngine) EditorGUILayout.EnumPopup ("Animation engine:", _target.animationEngine);
                if (_target.animationEngine == AnimationEngine.Sprites2DToolkit && !tk2DIntegration.IsDefinePresent ())
                {
                    EditorGUILayout.HelpBox ("The 'tk2DIsPresent' preprocessor define must be declared in the\ntk2DIntegration.cs script. Please open it and follow instructions.", MessageType.Warning);
                }
                if (_target.animationEngine == AnimationEngine.Custom)
                {
                    _target.customAnimationClass = EditorGUILayout.TextField ("Script name:", _target.customAnimationClass);
                    _target.motionControl = (MotionControl) EditorGUILayout.EnumPopup ("Motion control:", _target.motionControl);
                }
            EditorGUILayout.EndVertical ();

            _target.animEngine.CharSettingsGUI ();

            EditorGUILayout.BeginVertical ("Button");
            EditorGUILayout.LabelField ("Movement settings:", EditorStyles.boldLabel);

            if (_target.GetMotionControl () == MotionControl.Automatic)
            {
             			_target.walkSpeedScale = EditorGUILayout.FloatField ("Walk speed scale:", _target.walkSpeedScale);
                _target.runSpeedScale = EditorGUILayout.FloatField ("Run speed scale:", _target.runSpeedScale);
                _target.acceleration = EditorGUILayout.FloatField ("Acceleration:", _target.acceleration);
                _target.deceleration = EditorGUILayout.FloatField ("Deceleration:", _target.deceleration);
            }
            if (_target.GetMotionControl () != MotionControl.Manual)
            {
                _target.turnSpeed = EditorGUILayout.FloatField ("Turn speed:", _target.turnSpeed);
            }
            _target.turnBeforeWalking = EditorGUILayout.Toggle ("Turn before walking?", _target.turnBeforeWalking);
            EditorGUILayout.EndVertical ();
        }
Exemple #48
0
        private Image CreateQRCode(AC.Pattern pattern, int scale)
        {
            ZXing.BarcodeWriter writer = new ZXing.BarcodeWriter();
            writer.Format = ZXing.BarcodeFormat.QR_CODE;

            string data = new string(pattern.GetRawData().Select(b => Convert.ToChar(b)).ToArray());
            ZXing.Common.BitMatrix matrix = writer.Encode(data);

            Bitmap result = new Bitmap(matrix.Width * scale, matrix.Height * scale);

            // This is probably better done with LockBits. Meh.
            for (int x = 0; x < matrix.Height; x++)
                for (int y = 0; y < matrix.Width; y++)
                {
                    Color pixel = matrix[x, y] ? Color.Black : Color.White;
                    for (int i = 0; i < scale; i++)
                        for (int j = 0; j < scale; j++)
                            result.SetPixel(x * scale + i, y * scale + j, pixel);
                }

            return result;
        }
Exemple #49
0
        static void Main(string[] args)
        {
            //  Existing stuff in the house

            Light bedRoomLights = new Light();

            AC acForTheHouse = new AC();

            // CREATE the On cmd

            LightOn trunbedRoomLightsOn = new LightOn(bedRoomLights);

            ACOn trunOnAC = new ACOn(acForTheHouse);

            // CREATE the off cmd

            LightOff trunbedRoomLightsOff = new LightOff(bedRoomLights);

            ACOff trunOffAC = new ACOff(acForTheHouse);

            // add the On  / off to the Remote

            RemoteController remote = new RemoteController();

            remote.InsertNewOnCommand(trunbedRoomLightsOn);
            remote.InsertNewOnCommand(trunOnAC);

            remote.InsertNewOffCommand(trunbedRoomLightsOff);
            remote.InsertNewOffCommand(trunOffAC);

            // turn on the Light and AC

            remote.PressButonOn(0);
            remote.PressButonOn(1);

            // turn off both
            remote.PressButonOff(0);
            remote.PressButonOff(1);
        }
        private void AddCharHoles(PolygonCollider2D navPoly, AC.Char charToExclude, CharacterEvasion characterEvasion)
        {
            ResetHoles (KickStarter.sceneSettings.navMesh, false);

            Vector2 navPosition = navPoly.transform.position;
            AC.Char[] characters = GameObject.FindObjectsOfType (typeof (AC.Char)) as AC.Char[];

            foreach (AC.Char character in characters)
            {
                CircleCollider2D circleCollider2D = character.GetComponent <CircleCollider2D>();
                if (circleCollider2D != null &&
                    (character.charState == CharState.Idle || characterEvasion == CharacterEvasion.AllCharacters) &&
                    (charToExclude == null || character != charToExclude) &&
                    Physics2D.OverlapPointNonAlloc (character.transform.position, NavigationEngine_PolygonCollider.results, 1 << KickStarter.sceneSettings.navMesh.gameObject.layer) != 0)
                {
                    circleCollider2D.isTrigger = true;
                    List<Vector2> newPoints3D = new List<Vector2>();

                    #if UNITY_5
                    Vector2 centrePoint = character.transform.TransformPoint (circleCollider2D.offset);
                    #else
                    Vector2 centrePoint = character.transform.TransformPoint (circleCollider2D.center);
                    #endif

                    float radius = circleCollider2D.radius * character.transform.localScale.x;

                    newPoints3D.Add (centrePoint + Vector2.up * radius);
                    newPoints3D.Add (centrePoint + Vector2.right * radius);
                    newPoints3D.Add (centrePoint - Vector2.up * radius);
                    newPoints3D.Add (centrePoint - Vector2.right * radius);

                    navPoly.pathCount ++;

                    List<Vector2> newPoints = new List<Vector2>();
                    for (int i=0; i<newPoints3D.Count; i++)
                    {
                        // Only add a point if it is on the NavMesh
                        if (Physics2D.OverlapPointNonAlloc (newPoints3D[i], NavigationEngine_PolygonCollider.results, 1 << KickStarter.sceneSettings.navMesh.gameObject.layer) != 0)
                        {
                            newPoints.Add (newPoints3D[i] - navPosition);
                        }
                        else
                        {
                            Vector2 altPoint = GetLineIntersect (newPoints3D[i], centrePoint);
                            if (altPoint != Vector2.zero)
                            {
                                newPoints.Add (altPoint - navPosition);
                            }
                        }
                    }

                    if (newPoints.Count > 1)
                    {
                        navPoly.SetPath (navPoly.pathCount-1, newPoints.ToArray ());
                    }
                }
            }

            RebuildVertexArray (navPoly.transform, navPoly);
        }
 public static void OnElementClick(AC.Menu _menu, MenuElement _element, int _slot, int _buttonPressed)
 {
     // This function is called whenever a clickable element has a click type of "Custom Script".
 }
Exemple #52
0
 public SFS()
 {
     SD = new SD();
     AC = new AC();
     FC = new FC();
 }
 public override void Declare(AC.Char _character)
 {
     character = _character;
     turningStyle = TurningStyle.Linear;
     isSpriteBased = true;
 }
Exemple #54
0
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick (_menu, _slot, _mouseState);

            if (craftingType == CraftingElementType.Ingredients)
            {
                HandleDefaultClick (_mouseState, _slot);
            }
            else if (craftingType == CraftingElementType.Output)
            {
                ClickOutput (_menu, _mouseState);
            }

            _menu.Recalculate ();
        }
Exemple #55
0
 public override void LoadUnityUI(AC.Menu _menu)
 {
     int i=0;
     foreach (UISlot uiSlot in uiSlots)
     {
         uiSlot.LinkUIElements ();
         if (uiSlot != null && uiSlot.uiButton != null)
         {
             int j=i;
             uiSlot.uiButton.onClick.AddListener (() => {
                 ProcessClick (_menu, j, MouseState.SingleClick);
             });
         }
         i++;
     }
 }
Exemple #56
0
        public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
        {
            if (KickStarter.stateHandler.gameState == GameState.Cutscene)
            {
                return;
            }

            base.ProcessClick (_menu, _slot, _mouseState);
            if (uiToggle != null)
            {
                isOn = uiToggle.isOn;
            }
            else
            {
                if (isOn)
                {
                    isOn = false;
                }
                else
                {
                    isOn = true;
                }
            }

            if (toggleType == AC_ToggleType.Subtitles)
            {
                Options.optionsData.showSubtitles = isOn;
                Options.SavePrefs ();
            }
            else if (toggleType == AC_ToggleType.Variable)
            {
                if (varID >= 0)
                {
                    GVar var = RuntimeVariables.GetVariable (varID);
                    if (var.type == VariableType.Boolean)
                    {
                        if (isOn)
                        {
                            var.val = 1;
                        }
                        else
                        {
                            var.val = 0;
                        }
                        var.Upload ();
                    }
                }
            }

            if (toggleType == AC_ToggleType.CustomScript)
            {
                MenuSystem.OnElementClick (_menu, this, _slot, (int) _mouseState);
            }

            if (actionListOnClick)
            {
                AdvGame.RunActionListAsset (actionListOnClick);
            }
        }
Exemple #57
0
        public override void LoadUnityUI(AC.Menu _menu)
        {
            uiToggle = LinkUIElement <Toggle>();

            if (uiToggle)
            {
                if (uiToggle.GetComponentInChildren <Text>())
                {
                    uiText = uiToggle.GetComponentInChildren <Text>();
                }
                uiToggle.onValueChanged.AddListener ((isOn) => {
                    ProcessClick (_menu, 0, KickStarter.playerInput.mouseState);
                });
            }
        }
 private void tmpStartTime_SelectedTimeChanged(object sender, AC.AvalonControlsLibrary.Controls.TimeSelectedChangedRoutedEventArgs e)
 {
     try
     {
         DateTime dt = Convert.ToDateTime(dtpStartDate.SelectedDate);
         StartDate = new DateTime(dt.Year, dt.Month, dt.Day, tmpStartTime.SelectedHour, tmpStartTime.SelectedMinute, tmpStartTime.SelectedSecond);
     }
     catch (Exception ex)
     {
         ExceptionManager.Publish(ex);
     }
 }
Exemple #59
0
 /**
  * <summary>Performs what should happen when the element is clicked on.</summary>
  * <param name = "_menu">The element's parent Menu</param>
  * <param name = "_slot">Ignored by this subclass</param>
  * <param name = "_mouseState">The state of the mouse button</param>
  */
 public override void ProcessClick(AC.Menu _menu, int _slot, MouseState _mouseState)
 {
     base.ProcessClick (_menu, _slot, _mouseState);
     KickStarter.playerMenus.SelectInputBox (this);
 }
Exemple #60
0
 /**
  * <summary>Initialises the linked Unity UI GameObject.</summary>
  * <param name = "_menu The element's parent Menu</param>
  */
 public override void LoadUnityUI(AC.Menu _menu)
 {
     uiInput = LinkUIElement <InputField>();
 }