protected void InstantiateWidgets() { IConfig defaults = config.Configs["defaults"]; IConfig labels = config.Configs["labels"]; maxLevel = defaults.GetInt("maxLevel"); calc = new LevelCalculator(maxLevel); Arrow arrowDown = new Arrow(ArrowType.Down, ShadowType.None); Arrow arrowUp = new Arrow(ArrowType.Up, ShadowType.None); currentLevelDown = new Button(); currentLevelDown.Add(arrowDown); currentLevelUp = new Button(); currentLevelUp.Add(arrowUp); currentLevelLabel = new Label(labels.GetString("currentLevel")); currentLevel = new Entry(defaults.GetInt("entrySize")); currentLevel.SetSizeRequest(defaults.GetInt("entryWidth"), currentLevel.SizeRequest().Height); blue = new LevelRangeWidget(labels.GetString("blue")); darkwraith = new LevelRangeWidget(labels.GetString("darkwraith"), 0, calc.MaxLevel); red = new LevelRangeWidget(labels.GetString("red"), 0, calc.MaxLevel); white = new LevelRangeWidget(labels.GetString("white")); vbox = new VBox(false, 1); t = new Table((uint)defaults.GetInt("tableRows"), (uint)defaults.GetInt("tableCols"), false); }
public Bow(GameplayScreen gameplayScreen, GameCharacter owner) : base(gameplayScreen, owner) { _arrow = new Arrow(ImageManager.ArrowTexture); coolDownTime = 1.5; coolDownElapsed = 0; }
public void ShootArrow() { if (arrowDrawn == null) return; arrowDrawn.Fire(); arrowDrawn = null; }
public void Reset() { m_equipedRangeWeapon = PlayerStash.Instance.PurchasedCrossbow > 0 ? WEAPON_CROSSBOW : WEAPON_BOW; m_equipedMeleeWeapon = PlayerStash.Instance.PurchasedAxe > 0 ? WEAPON_AXE : WEAPON_SWORD; UseWeapon(m_equipedRangeWeapon); m_walkAccelerate = 0.0f; m_attackDirection = 0.0f; m_isAttacking = false; m_willAttack = false; m_hasAttackDoneDamage = 0; m_hasAttackPlaySound = 0; m_keyDelta = 0.0f; m_bendSpineTarget = 0.0f; m_currentWeaponTrail = null; if (m_holdingArrow != null) { GameObject.Destroy(m_holdingArrow.gameObject); } m_holdingArrow = null; m_hasTouchBegan = false; m_animator.CrossFade (ANIM_IDLE, 0.1f, 0, 0.0f); m_animator.SetBool(VAR_ATTACK, false); m_animator.SetFloat(VAR_WALK, 0.0f); m_isDying = false; m_HP = MaxHP; }
public override void Use() { Vector3 tArrowPos = m_pUser.Position + (m_pUser.Forward.normalized * 2.0f) + Vector3.up; Arrow pArrow = new Arrow(tArrowPos, m_pUser.Forward, m_pUser.Atk + m_iAtk, m_fRange, m_pUser.CharSide); VisualArrow pVisualArrow = GameObject.Instantiate(s_pArrowRef, tArrowPos, Quaternion.identity) as VisualArrow; // I know this should go in a VisualBow.cs but as it would be for one line, I figured it's forgetable, this time pVisualArrow.ArrowBUS = pArrow; }
// ------------------------------------------------------------------ // Desc: // ------------------------------------------------------------------ public void Return( Arrow _arrow ) { ++idx; if ( idx >= size ) idx = size - 1; arrows[idx] = _arrow; }
public void InitialiseArrows() { progressArrow = Op.Arr((int x) => 50.0 + (50.0*Math.Sin(x / 30.0))); var sinArrow = progressArrow.Combine(Op.Arr((double x) => (int)x)); var textSizeArrow = Op.Arr((int length) => new String('☺', length)); arrow = sinArrow.Combine(textSizeArrow); }
// Use this for initialization void Start() { base.initialise(); //instantiates moveArrow, vector2, and halo staticArrow = GameObject.Find("Cluster/StaticArrow").GetComponent<Arrow>(); numLine = GameObject.Find("Cluster/StaticArrow/NumLine").transform; vector1 = GameObject.Find("Canvas/Header/Vector1").GetComponent<UIvector>(); //mapped to staticArrow vector1.set(staticArrow.toVector()); //staticArrow does not move }
void Start() { _trail = this.GetComponent<TrailRenderer>(); _trail.time = Mathf.Infinity; _player = GameObject.FindObjectOfType<Arrow>().GetComponent<Arrow>(); this.transform.position = _player.transform.position; _trail.startWidth = _player.transform.localScale.x; _trail.endWidth = _player.transform.localScale.x; }
// Use this for initialization void Start() { base.initialise(); //instantiates moveArrow, vector2, and halo staticArrow = GameObject.Find("Cluster/StaticArrow").GetComponent<Arrow>(); crossProduct = GameObject.Find("Cluster/CrossProduct").GetComponent<Arrow>(); gridToggle = GameObject.Find("Canvas/GridToggle").GetComponent<Toggle>(); vector1 = GameObject.Find("Canvas/Header/Vector1").GetComponent<UIvector>(); //mapped to staticArrow vector1.set(staticArrow.toVector()); //staticArrow does not move vector3 = GameObject.Find("Canvas/Header/Vector3").GetComponent<UIvector>(); //mapped to crossProduct }
DiagramVisualItem CreateLocalSendCommandMessage() { var arrow = new Arrow(new StoredMessage { MessageType = "LocalSend", Status = MessageStatus.Successful }, null) { Width = LocalArrowWidth, Type = ArrowType.Local }; return new DiagramVisualItem { Content = arrow }; }
DiagramVisualItem CreateTimeoutMessage() { var arrow = new Arrow(new StoredMessage { MessageType = "Timeout", Status = MessageStatus.Successful }, null) { Width = LocalArrowWidth, Type = ArrowType.Timeout }; return new DiagramVisualItem { Content = arrow }; }
public void TestArrowDemo() { Console.WriteLine("\t-- Testing arrow demo --\n"); Arrow<int, int>.func demo1 = x => x * x + 3; // Simple arrow test - 'test' is passed through the function 'demo1' to 'result' TestSourceObject source = new TestSourceObject(); source.value = 3; BindingDestination<int> result = new BindingDestination<int>(0); Arrow<int, int> testArrow = new Arrow<int, int>(demo1); ArrowTestThing.Binding<int, int> testBinding = new ArrowTestThing.Binding<int, int>(source, "value", testArrow, result); // Change the value of 'test' randomly and assert that 'result' changes accordingly Console.WriteLine("Testing single binding..."); Random random = new Random(); for (int i = 0; i < 500; i++) { source.value = random.Next(0, 1000); Assert.AreEqual(result, demo1(source.value)); } Console.WriteLine("Tests passed!"); Console.WriteLine(); Arrow<int, int>.func2 demo2 = (b, h) => (b * h) / 2; // Pair arrow test - 's1' and 's2' are treated as the breadth and height of a triangle, // and 'result' is now bound to the area of said triangle BindingSource<int> s1 = new BindingSource<int>(4); BindingSource<int> s2 = new BindingSource<int>(3); Arrow<int, int> dualArrow = new Arrow<int, int>(demo2); PairBinding<int, int> pairBinding = new PairBinding<int, int>(s1, s2, dualArrow, result); // Change the values of 's1' and 's2' randomly and assert that 'result' changes accordingly Console.WriteLine("Testing double binding..."); random = new Random(); for (int i = 0; i < 500; i++) { s1.Value = random.Next(0, 1000); s2.Value = random.Next(0, 1000); Assert.AreEqual(result, demo2(s1.Value, s2.Value)); } Console.WriteLine("Tests passed!"); Console.WriteLine(); Console.WriteLine("All tests passed successfully.\n\n"); }
override public void DoEffect(Arrow arrow) { if(effected ) return; effected = true; createExplosion(); createSound(); Control control = FindObjectOfType(typeof(Control)) as Control; control.Freeze(FREEZETIME); recycle(); }
override public void DoEffect(Arrow arrow) { if(effected ) return; effected = true; createSound(); GameStatus.Inst.EarnScore(arrow.Combo++, TARGET_ID); Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if(e != null) e.addEnergy(20); recycle(); }
public void InitialiseCircleArrow(int xRadius, int yRadius, int cX, int cY) { Arrow<int, Tuple<int, int>> timeDup = Op.Split<int>(); Arrow<int, double> sin = Op.Arr((int x) => cX + xRadius * Math.Sin((double)x / 20)); Arrow<int, double> cos = Op.Arr((int y) => cY + yRadius * Math.Cos((double)y / 20)); Arrow<Tuple<int, int>, Tuple<double, double>> sinCos = sin.And(cos); Arrow<double, int> doubleToInt = Op.Arr((double x) => (int)x); Arrow<Tuple<double, double>, Tuple<int, int>> adapter = doubleToInt.And(doubleToInt); circle = timeDup.Combine(sinCos).Combine(adapter); }
override public void DoEffect(Arrow arrow) { createExplosion(); createSound(); /* Don't Destroy the Wall Target, destroy the arrow */ Destroy(arrow.gameObject); if(arrow.rigidbody.velocity.z < 0) { Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if(e != null) e.addEnergy(20); recycle(); } }
public virtual ILink CreateLink(Arrow arrow, bool keepGroups, bool ignoreArrowDirection) { if (_links.Contains(arrow)) return _links[arrow] as ILink; FCLink result = new FCLink(); _links[arrow] = result; result.Create(arrow, keepGroups, ignoreArrowDirection, this); return result; }
override public void DoEffect(Arrow arrow) { if(effected ) return; effected = true; // Dim the lights to create a dark scene LightControl l = GameObject.FindObjectOfType(typeof(LightControl)) as LightControl; l.TurnDark(); createExplosion(); createSound(); recycle(); Destroy(arrow.gameObject); }
//previous is to tell this arrow which came before it. //this arrow can only be hit if the one before it was hit prior public void setup(Vector3 pos, Arrow previousArrow) { transform.position = pos; renderer.enabled = true; collider.enabled = true; isOnBoard = true; this.previousArrow = previousArrow; isLookingAt = false; if(isUsingEndMat) { renderer.material = ArrowMat; isUsingEndMat = false; } }
void Start () { _instance = this; texture = this.GetComponent<UISprite>(); originalPosition = this.transform.position; hash = new Dictionary<ArrowState, StateMapElement>(){ { ArrowState.Hide, new StateMapElement(){ Alpha=0.0f, spriteName="arrow_l", moveTo = Vector3.zero } }, { ArrowState.Left, new StateMapElement(){ Alpha=1.0f, spriteName="arrow_l", moveTo = Vector3.left } }, { ArrowState.Right, new StateMapElement(){ Alpha=1.0f, spriteName="arrow_r", moveTo = Vector3.right } }, { ArrowState.Down, new StateMapElement(){ Alpha=1.0f, spriteName="arrow_b", moveTo = Vector3.down } }, }; texture.alpha = 0.0f; //this.State = ArrowState.Hide; }
override public void DoEffect(Arrow arrow) { if (effected) { return; } effected = true; createExplosion(); createSound(); Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if (e != null) { e.addEnergy(20); } }
override public void DoEffect(Arrow arrow) { if(effected ) return; effected = true; createExplosion(); createSound(); Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if(e != null) e.addEnergy(20); // Add extra ammo for destroying this target GameStatus.Inst.ArrowCount += EXTRA_AMMO; GameStatus.Inst.EarnScore(arrow.Combo++, TARGET_ID); recycle(); }
override public void DoEffect(Arrow arrow) { if(effected ) return; effected = true; createExplosion(); Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if(e != null) e.addEnergy(20); GameStatus.Inst.EarnScore(arrow.Combo++, TARGET_ID); TimeTarget tt = gameObject.GetComponent(typeof(TimeTarget)) as TimeTarget; tt.createSound(); GameStatus.Inst.IncreaseTime(EXTRA_TIME); recycle(); }
public override void OnFixedUpdate() { if (C.isTransitioning) return; if (initDelay > 0) { if (stateCount > initDelay) { initDelay = 0; stateCount = 0; } return; } if (loaded) { if (stateCount > .5f) { Arrow a = new Arrow(this, world); a.SetDirection(CurrentDirection); a.PlayAnim(); switch(CurrentDirection) { case Direction.UP: a.yVel = arrowSpeed; break; case Direction.RIGHT: a.xVel = arrowSpeed; break; case Direction.DOWN: a.yVel = -arrowSpeed; break; case Direction.LEFT: a.xVel = -arrowSpeed; break; } a.SetPosition(this.GetPosition()); world.addObject(a); loaded = false; stateCount = 0; } } else { if (stateCount > interval) { loaded = true; stateCount = 0; } } base.OnFixedUpdate(); PlayAnim(); }
public MessageProcessingRoute(Arrow arrow, Handler processingHandler) { FromArrow = arrow; ProcessingHandler = processingHandler; if (FromArrow != null && ProcessingHandler != null) { Name = ProcessingHandler.Name + string.Format("({0})", FromArrow.MessageId); } if (FromArrow != null) { FromArrow.Route = this; } if (ProcessingHandler != null) { ProcessingHandler.Route = this; } }
override public void DoEffect(Arrow arrow) { /* Decrease hit points */ hit_points = hit_points - Arrow.DMG_AMOUNT; if(hit_points <= 0){ if(effected ) return; effected = true; createExplosion(); createSound(); // Earn Score for destroying the Strong Target GameStatus.Inst.EarnScore(arrow.Combo++, TARGET_ID); Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if(e != null) e.addEnergy(40); recycle(); } else if(hit_points < 50 && hit_points > 0){ renderer.material = secondMaterial; Destroy(arrow.gameObject); } }
override public void DoEffect(Arrow arrow) { if(effected ) return; effected = true; createExplosion(); createSound(); Energy e = GameObject.FindObjectOfType(typeof(Energy)) as Energy; if(e != null) e.addEnergy(20); // Earn Score for destroying the Bomb Target GameStatus.Inst.EarnScore(arrow.Combo++, TARGET_ID); // Find game objects of NormalTarget type // Check if the distance of the "BombTarget" and this "Target" is less than the damage_radius Object[] gos = GameObject.FindObjectsOfType(typeof(Target)); foreach(Object go in gos) { Target t = go as Target; if(t.gameObject.active == false) continue; if(t is WallTarget){ continue; } if(Vector3.Distance(gameObject.transform.position, t.transform.position) < damage_radius) { StrongTarget s = t as StrongTarget; if(s != null) s.hit_points = -1; t.DoEffect(arrow); } } Destroy(arrow.gameObject); recycle(); }
// Start is called before the first frame update void Start() { arrowOriginal = FindObjectOfType <Arrow>(); }
public Player FinishReviving() { Vector2 zero = Vector2.Zero; Player result; if (this.Corpse.Squished == Vector2.Zero && this.CanReviveAtThisPosition(ref zero)) { PlayerInventory inventory = new PlayerInventory(false, false, false, false, new ArrowList(this.Corpse.Arrows)); // this.Corpse.Arrows.Clear (); // I don't know what this line does, but it was causing an accessibility exception if (this.Corpse.ArrowCushion.Count > 0) { Arrow arrow = this.Corpse.ArrowCushion.ArrowDatas [0].Arrow; if (inventory.Arrows.CanAddArrow(arrow.ArrowType) && arrow.Scene != null && !arrow.MarkedForRemoval) { base.Level.Remove <Arrow> (arrow); inventory.Arrows.AddArrows(new ArrowTypes[] { arrow.ArrowType }); } this.Corpse.ArrowCushion.ReleaseArrows(Vector2.UnitY * -1f); } if (this.Mode == TeamReviver.Modes.Quest && inventory.Arrows.Count == 0) { ArrowList arg_153_0 = inventory.Arrows; ArrowTypes[] arrows = new ArrowTypes[1]; arg_153_0.AddArrows(arrows); } Vector2 position = zero; Player player = new Player(this.Corpse.PlayerIndex, position, this.Corpse.Allegiance, this.Corpse.TeamColor, inventory, Player.HatStates.NoHat, true, false, false); if (this.Mode == TeamReviver.Modes.TeamDeathmatch) { player.Flash(45, null); } else { player.Flash(135, null); } base.Level.Add <Player> (player); //if (((MyMatchVariants)base.Level.Session.MatchSettings.Variants).GottaBustGhosts) { // ((MySession)base.Level.Session).OnTeamRevive(player); //} int playerIndex = this.reviver; if (playerIndex == -1) { playerIndex = player.PlayerIndex; } if (this.Mode == TeamReviver.Modes.DarkWorld) { Player player2 = base.Level.GetPlayer(this.reviver); if (player2 != null) { player2.Flash(60, null); } } ShockCircle shockCircle = Cache.Create <ShockCircle> (); shockCircle.Init(position, playerIndex, player, ShockCircle.ShockTypes.TeamRevive); base.Level.Add <ShockCircle> (shockCircle); int num = Calc.Random.Next(360); for (int i = num; i < num + 360; i += 30) { base.Level.Add <BombParticle> (new BombParticle(position, (float)i, BombParticle.Type.TeamRevive)); } TFGame.PlayerInputs [this.Corpse.PlayerIndex].Rumble(1f, 30); if (this.reviver != -1) { TFGame.PlayerInputs [this.reviver].Rumble(0.5f, 30); } if (this.reviver != -1) { MatchStats[] expr_2FA_cp_0 = base.Level.Session.MatchStats; int expr_2FA_cp_1 = this.reviver; expr_2FA_cp_0 [expr_2FA_cp_1].Revives = expr_2FA_cp_0 [expr_2FA_cp_1].Revives + 1u; if (base.Level.Session.DarkWorldState != null) { base.Level.Session.DarkWorldState.Revives [this.reviver]++; } } this.reviveCounter = 0f; if (this.Corpse.TeamColor == Allegiance.Red) { Sounds.sfx_reviveRedteamFinish.Play(210f, 1f); } else { Sounds.sfx_reviveBlueteamFinish.Play(210f, 1f); } result = player; } else { result = null; } // If ghost revives is on, then a revive can cancel a level ending if (this.ghostRevives && base.Level.Session.MatchSettings.Mode == Modes.TeamDeathmatch) { Allegiance allegiance; if (!base.Level.Session.RoundLogic.TeamCheckForRoundOver(out allegiance)) { base.Level.Session.CurrentLevel.Ending = false; } } return(result); }
void Add(Arrow arrow) { arrows.Add(arrow); Add(arrow, arrow.Source.Block, outputs); Add(arrow, arrow.Target.Block, inputs); }
// // PUBLIC METHODS // public override void OpenModel() { // Exit if invalid if (this._topology == null) { return; } // Suspend Model if (ModelSettings.Default.EnableUndoRedo) { this.UndoList.Suspend(); } this.Suspend(); this.SuspendEvents = true; // Add GeometricNetwork Shape EsriShape <Topology> shapeTopology = new EsriShape <Topology>(this._topology); this.Shapes.Add(base.Shapes.CreateKey(), shapeTopology); // Get Parent FeatureDataset Dataset parent = this._topology.GetParent(); if (parent == null) { return; } FeatureDataset featureDataset = parent as FeatureDataset; if (featureDataset == null) { return; } // Add FeatureDataset Shape EsriShape <FeatureDataset> shapeFeatureDataset = new EsriShape <FeatureDataset>(featureDataset); this.Shapes.Add(base.Shapes.CreateKey(), shapeFeatureDataset); // Add all Child FeatureClasses foreach (Dataset dataset in featureDataset.GetChildren()) { if (dataset.GetType() == typeof(FeatureClass)) { // Add FetaureClass Shape FeatureClass featureClass = (FeatureClass)dataset; EsriShape <FeatureClass> shapeFeatureClass = new EsriShape <FeatureClass>(featureClass); this.Shapes.Add(base.Shapes.CreateKey(), shapeFeatureClass); // Add Link Arrow arrow = new Arrow(); arrow.BorderColor = ModelSettings.Default.DisabledLined; arrow.DrawBackground = false; Line line = new Line(shapeFeatureClass, shapeFeatureDataset); line.BorderColor = ModelSettings.Default.DisabledLined; line.End.AllowMove = false; line.Start.Marker = arrow; line.Start.AllowMove = false; this.Lines.Add(base.Lines.CreateKey(), line); foreach (ControllerMembership controllerMembership in featureClass.ControllerMemberships) { if (controllerMembership is TopologyControllerMembership) { TopologyControllerMembership topologyControllerMembership = (TopologyControllerMembership)controllerMembership; if (topologyControllerMembership.TopologyName == this._topology.Name) { EsriLine <TopologyControllerMembership> line2 = new EsriLine <TopologyControllerMembership>(topologyControllerMembership, shapeTopology, shapeFeatureClass); this.Lines.Add(base.Lines.CreateKey(), line2); } } } } } // Perform Layout this.ExecuteLayout(typeof(HierarchicalLayout), true); // Resume and Refresh Model this.SuspendEvents = false; this.Resume(); if (ModelSettings.Default.EnableUndoRedo) { this.UndoList.Resume(); } this.Refresh(); }
public override void Init(Competition content) { base.Init(content); ContentCaption = string.Format("{0} - Турнирная таблица", content.Name); var tt = DbContext.TeamCompetitionSet.Where(f => f.CompetitionId == Competition.Id).GroupBy(f => f.Team).Where(f => f.Count() > 1).ToList(); if (tt.Count > 0) { } TeamCompetitions = DbContext.TeamCompetitionSet.Where(f => f.CompetitionId == Competition.Id).ToDictionary(f => f.TeamId, f => f); var teams = DbContext.TeamSet.Where(f => f.Used).ToList(); var games = DbContext.GameSet.Where(f => f.CompetitionId == Competition.Id).ToList(); var stages = DbContext.StageSet.Where(f => f.CompetitionId == Competition.Id).ToList(); var xOffset = 10; var yStart = 60; var yStep = 40; Stage lastStage = null; foreach (var stage in stages.OrderByDescending(f => f.Type)) { diagram.Model.Shapes.Add(new Crainiate.Diagramming.Shape() { Location = new PointF(xOffset, 10), Width = 150, Height = 20, Label = new Crainiate.Diagramming.Label(stage.Name), BackColor = Color.LightGray }); if (lastStage != null && lastStage.Game.Count > stage.Game.Count) { yStart = 60 + yStep; yStep = (int)(yStep * 2); } var yOffset = yStart; foreach (var game in stage.Game) { var shape = new GameShape(); shape.Location = new PointF(xOffset, yOffset); yOffset += yStep; shape.Width = 150; shape.Height = 35; shape.DrawSelected = false; shape.Tag = game; diagram.Model.Shapes.Add(game.Id.ToString(), shape); ShapeDict.Add(game, shape); } lastStage = stage; xOffset += 200; } Arrow arrow = new Arrow(); arrow.DrawBackground = true; arrow.Inset = 8; foreach (var item in ShapeDict) { if (item.Key.ParentGame1 != null && ShapeDict.ContainsKey(item.Key.ParentGame1)) { var line = new Link(diagram.Model.Shapes[item.Key.ParentGame1.Id.ToString()], diagram.Model.Shapes[item.Key.Id.ToString()]); line.End.Marker = arrow; diagram.Model.Lines.Add(diagram.Model.Lines.CreateKey(), line); } if (item.Key.ParentGame2 != null && ShapeDict.ContainsKey(item.Key.ParentGame2)) { var line = new Link(diagram.Model.Shapes[item.Key.ParentGame2.Id.ToString()], diagram.Model.Shapes[item.Key.Id.ToString()]); line.End.Marker = arrow; diagram.Model.Lines.Add(diagram.Model.Lines.CreateKey(), line); } } diagram.Model.SetSize(new Size(xOffset, yStart * 2)); UpdateDiagram(); diagram.Refresh(); }
public SafeObject(Arrow arrow) { _arrow = arrow; }
// Start is called before the first frame update void Start() { _rb = GetComponent <Rigidbody2D>(); arrow = FindObjectOfType <Arrow>(); _dir = arrow.dir; }
private void FireArrow() { m_CurrentArrow.Fire(m_PullValue); m_CurrentArrow = null; }
public bool Contains(Arrow obj) { return(List.Contains(obj)); }
public void Remove(Arrow a) { List.Remove(a); }
public void Insert(int i, Arrow a) { List.Insert(i, a); }
void Start() { touch = GameObject.Find("Touch").GetComponent <Touch>(); circle = GameObject.Find("WhiteCircle").GetComponent <GrayCircle>(); arrow = GameObject.Find("Arrow").GetComponent <Arrow>(); }
public override void Analyze(Analysis Mna) { Expression Vin = DependentVariable(Name, t); VoltageSource.Analyze(Mna, Anode, Cathode, Vin, Arrow.New(Vin.Evaluate(t, 0), 0)); }
public State getTestState(){ StateWithEventMap state = TaskState.Create(delegate{ TaskWait wait = new TaskWait(0.1f); return wait; }, this.fsm_, delegate(FSMEvent evt) { MapCtrl map = this.getMap(); Vector3 target = getWorldTarget(); VectorInt2 cell = map.position2cell(new Vector2(target.x, target.z)); IMapData data = map.ask(cell); bool isPass = data.pass( map.position2cell( new Vector2(this._alien.gameObject.transform.position.x, this._alien.gameObject.transform.position.z))); if(isPass){ return "walk"; }else{ _director = Arrow.Stop; if(_arrow == Arrow.Right){ _arrow = Arrow.Left; }else{ _arrow = Arrow.Right; } //_arrow = Arrow.Stop; return "stop"; } }); return state; }
public void RegisterArrow(Arrow arrow) { activeArrows.Add(arrow); }
/// <summary> /// ラインを返す /// </summary> /// <returns>The Line.</returns> /// <param name="point">Point.</param> private static List <int> getLine(int point, Arrow arrow) { var result = new List <int> (); int target = 0; switch (arrow) { case Arrow.TOP: while (true) { target = target - OCT; if (target < 0) { break; } result.Add(target); } break; case Arrow.BOTTOM: while (true) { target = target + OCT; if (target >= OCT * OCT) { break; } result.Add(target); } break; case Arrow.LEFT: while (true) { target = target - 1; if (target % OCT > point % OCT) { break; } result.Add(target); } break; case Arrow.RIGHT: while (true) { target = target + 1; if (target % OCT < point % OCT) { break; } result.Add(target); } break; case Arrow.LEFT_TOP: while (true) { target = target - OCT + 1; if (target < 0 || target % OCT > point % OCT) { break; } result.Add(target); } break; case Arrow.RIGHT_TOP: while (true) { target = target - OCT - 1; if (target < 0 || target % OCT < point % OCT) { break; } result.Add(target); } break; case Arrow.LEFT_BOTTOM: while (true) { target = target + OCT - 1; if (target >= OCT * OCT || target % OCT > point % OCT) { break; } result.Add(target); } break; case Arrow.RIGHT_BOTTOM: while (true) { target = target + OCT + 1; if (target >= OCT * OCT || target % OCT < point % OCT) { break; } result.Add(target); } break; default: break; } return(result); }
Arrow ra; //The ArrowAttributes script we'll be referencing //Initialize values void Start() { ra = GetComponent <Arrow>(); maxFuel = ra.GetFuel(); //Only need to do this once. maxHealth = ra.GetHealth(); }
public override void Initialize() { // Determine the position and size of the interface. int x = 0, y = 0, w = 50, h = 40; // Pass an empty provider to the panel (the interface will be drawn on Main.tile). object provider = null; // Although we can use as a provider, for example, FakeTileRectangle from FakeManager: //object provider = FakeManager.FakeManager.Common.Add("TestPanelProvider", x, y, w, h); // Create a panel with a wall of diamond gemspark wall with black paint. Panel root = TUI.TUI.Create(new Panel("TestPanel", x, y, w, h, null, new ContainerStyle() { Wall = WallID.DiamondGemspark, WallColor = PaintID.Black }, provider)) as Panel; // Create a Label widget (text display) with white characters. Label label1 = new Label(1, 1, 17, 2, "some text", new LabelStyle() { TextColor = PaintID.White }); // Add to panel root.Add(label1); // Create a container that occupies the lower (larger) half of our panel, painted over with white paint. // The Add function returns the newly added object in the VisualObject type, // so adding an element can be implemented as follows: VisualContainer node = root.Add( new VisualContainer(0, 15, w, 25, null, new ContainerStyle() { WallColor = PaintID.White }) ) as VisualContainer; // Add a button to this container, which, when clicked, will send the clicker to the chat. /*node.Add(new Button(5, 0, 12, 4, "lol", null, new ButtonStyle() * { Wall = 165, WallColor = PaintID.DeepGreen }, (self, touch) => * touch.Player().SendInfoMessage("You pressed lol button!")));*/ if (false) { // Set the layout configuration. node.SetupLayout(Alignment.Center, Direction.Right, Side.Center, null, 3, false); // Add the InputLabel widget to the layout that allows you to input text. node.AddToLayout(new InputLabel(0, 0, new InputLabelStyle() { TextColor = PaintID.Black, Type = InputLabelType.All, TextUnderline = LabelUnderline.None }, new Input <string>("000", "000"))); // Add to the layout one more ItemRack widget that corresponds to the Weapon rack: displaying an item // on a 3x3 rack. By clicking displays the relative and absolute coordinates of this click. node.AddToLayout(new ItemRack(0, 0, new ItemRackStyle() { Type = 200, Left = true }, (self, touch) => Console.WriteLine($"Touch: {touch.X}, {touch.Y}; absolute: {touch.AbsoluteX}, {touch.AbsoluteY}"))); ItemRack irack1 = node.AddToLayout(new ItemRack(0, 0, new ItemRackStyle() { Type = 201, Left = true })) as ItemRack; // ItemRack allows you to add text on top using a sign: irack1.SetText("lololo\nkekeke"); // Finally, add the slider to the layout. node.AddToLayout(new Slider(0, 0, 10, 2, new SliderStyle() { Wall = WallID.AmberGemsparkOff, WallColor = PaintID.White })); } if (false) { // Set up the grid configuration. Specify that it has to fill all the cells automatically. // Two columns (right size of 15, left - everything else) and two lines, occupying the same amount of space. node.SetupGrid( new ISize[] { new Relative(100), new Absolute(15) }, // Размеры колонок new ISize[] { new Relative(50), new Relative(50) }, // Размеры линий null, true); // In the top left cell (at the intersection of the first column and the first line), set the background color to orange. node[0, 0].Style.WallColor = PaintID.DeepOrange; // At the top right, we put a sapphire (blue) wall without paint. node[1, 0].Style.Wall = WallID.SapphireGemspark; node[1, 0].Style.WallColor = PaintID.None; // In the bottom left cell, you can place the Label widget with the SandStoneSlab block. // Although the coordinates and sizes are specified as 0, they will automatically be // set, since the object is in the Grid. node[0, 1] = new Label(0, 0, 0, 0, "testing", null, new LabelStyle() { Tile = TileID.SandStoneSlab, TileColor = PaintID.Red, TextColor = PaintID.Black }); } if (false) { // Install a large and complex grid. node.SetupGrid(new ISize[] { new Absolute(3), new Relative(50), new Absolute(6), new Relative(50) }, new ISize[] { new Relative(20), new Absolute(5), new Relative(80) }); // Although we set the grid on the node, we can still add objects as before. // Add a button that draws the grid by pressing, and hides it when released. node.Add(new Button(3, 3, 10, 4, "show", null, new ButtonStyle() { WallColor = PaintID.DeepBlue, BlinkStyle = ButtonBlinkStyle.Full, TriggerStyle = ButtonTriggerStyle.Both }, (self, touch) => { if (touch.State == TouchState.Begin) { node.ShowGrid(); } else { node.Apply().Draw(); } })); } if (false) { // Add a label and immediately set Alignment.DownRight with indent 3 blocks to the right and 1 below. node.Add(new Label(0, 0, 16, 6, "test", new LabelStyle() { WallColor = PaintID.DeepPink })) .SetAlignmentInParent(Alignment.DownRight, new ExternalIndent() { Right = 3, Down = 1 }); } if (false) { // Let's make our node container the size of the root in width. node.SetFullSize(true, false); } node.SetupLayout(Alignment.Center, Direction.Down, Side.Center, null, 1, false); // VisualObject VisualObject obj = node.AddToLayout(new VisualObject(5, 5, 8, 4, null, new UIStyle() { Wall = WallID.AmethystGemspark, WallColor = PaintID.DeepPurple }, (self, touch) => TSPlayer.All.SendInfoMessage($"Relative: ({touch.X}, {touch.Y}); Absolute: ({touch.AbsoluteX}, {touch.AbsoluteY})"))); // VisualContainer //VisualContainer node2 = node.Add( // new VisualContainer(5, 5, 20, 10, null, new ContainerStyle() { WallColor = PaintID.Black }) //) as VisualContainer; // Label Label label = node.AddToLayout(new Label(15, 5, 19, 4, "some text", new LabelStyle() { WallColor = PaintID.DeepLime, TextColor = PaintID.DeepRed })) as Label; // Button Button button = node.AddToLayout(new Button(15, 5, 12, 4, "lol", null, new ButtonStyle() { WallColor = PaintID.DeepGreen, BlinkColor = PaintID.Shadow, TriggerStyle = ButtonTriggerStyle.TouchEnd }, (self, touch) => touch.Player().SendInfoMessage("You released lol button!"))) as Button; // Slider Slider slider = node.AddToLayout(new Slider(15, 5, 10, 2, new SliderStyle() { Wall = WallID.EmeraldGemspark, WallColor = PaintID.White, SeparatorColor = PaintID.Black, UsedColor = PaintID.DeepOrange }, new Input <int>(0, 0, (self, value, playerIndex) => TShock.Players[playerIndex].SendInfoMessage("Slider value: " + value)))) as Slider; // Checkbox Checkbox checkbox = node.AddToLayout(new Checkbox(15, 5, 2, new CheckboxStyle() { Wall = WallID.EmeraldGemspark, WallColor = PaintID.White, CheckedColor = PaintID.DeepRed }, new Input <bool>(false, false, (self, value, playerIndex) => TSPlayer.All.SendInfoMessage("Checkbox value: " + value)))) as Checkbox; // Separator Separator separator = node.AddToLayout(new Separator(6, new UIStyle() { Wall = 156, WallColor = PaintID.DeepRed })) as Separator; // InputLabel InputLabel input = node.AddToLayout(new InputLabel(15, 5, new InputLabelStyle() { Type = InputLabelType.All, TextUnderline = LabelUnderline.Underline, TextColor = PaintID.DeepRed, TextUnderlineColor = PaintID.Black // Этот параметр из LabelStyle }, new Input <string>("12345", "12345", (self, value, playerIndex) => TSPlayer.All.SendInfoMessage("InputLabel value: " + value)))) as InputLabel; // ItemRack ItemRack irack = node.AddToLayout(new ItemRack(15, 5, new ItemRackStyle() { Type = ItemID.LargeDiamond, Size = ItemSize.Biggest, Left = true })) as ItemRack; ItemRack irack2 = node.AddToLayout(new ItemRack(20, 5, new ItemRackStyle() { Type = ItemID.SnowmanCannon, Size = ItemSize.Smallest, Left = true })) as ItemRack; irack2.SetText("This is a snowman cannon."); // VisualSign VisualSign vsign = node.AddToLayout(new VisualSign(0, 0, "lmfao sosi(te pozhaluista)")) as VisualSign; VisualSign vsign2 = node.AddToLayout(new VisualSign(0, 0, "This is an example of what can happen " + "if you use signs in TUI without FakeManager (only $399!)." + "Text above would be empty. Even tho it has to have it...")) as VisualSign; // FormField FormField ffield = node.AddToLayout(new FormField( new Checkbox(0, 0, 2, new CheckboxStyle() { Wall = WallID.AmberGemspark, WallColor = PaintID.White, CheckedColor = PaintID.DeepRed }), 15, 5, 20, 2, "check me", new LabelStyle() { TextColor = PaintID.Shadow, TextAlignment = Alignment.Left }, new ExternalIndent() { Right = 1 })) as FormField; // Image Image image = node.AddToLayout(new Image(15, 5, "Media\\Image.TEditSch")) as Image; // Video Video video = node.AddToLayout(new Video(15, 5, null, new VideoStyle() { Path = "Media\\Animation-1", Delay = 100, TileColor = PaintID.DeepTeal }, (self, touch) => (self as Video).ToggleStart())) as Video; // AlertWindow Button alertButton = node.AddToLayout(new Button(15, 10, 16, 4, "alert", null, new ButtonStyle() { Wall = WallID.AmberGemspark, WallColor = PaintID.DeepOrange }, (self, touch) => node.Root.Alert("Hello world"))) as Button; // ConfirmWindow Button confirmButton = node.AddToLayout(new Button(15, 13, 20, 4, "confirm\npls", null, new ButtonStyle() { Wall = WallID.AmberGemspark, WallColor = PaintID.DeepTeal }, (self, touch) => node.Root.Confirm("Very nice", value => TSPlayer.All.SendInfoMessage("Confirmed? " + value)))) as Button; // ScrollBackground // <Adding a lot of widgets to layout> // Specifying layer value as Int32.MinValue so that this widget would be under all other child objects, // although ScrollBackground specifies this layer by default in custructor so we don't have to do it manually. ScrollBackground scrollbg = node.Add(new ScrollBackground(true, true, true), Int32.MinValue) as ScrollBackground; // ScrollBar ScrollBar scrollbar = node.Add(new ScrollBar(Direction.Right)) as ScrollBar; // Arrow Arrow arrow = node.AddToLayout(new Arrow(15, 5, new ArrowStyle() { TileColor = PaintID.DeepBlue, Direction = Direction.Left })) as Arrow; }
private void ReleaseArrow() { currentArrow.Release(puller.PullAmount); currentArrow = null; }
private void Debug(Arrow arrow) { d.Append(arrow, Blocks, x, y); }
private void ChartToCreate(String item) { List <String[]> originalData = ChartData(); String[] dataPicker = new String[originalData.Count]; for (int i = 0; i < originalData.Count; i++) { dataPicker[i] = originalData[i][1]; } _customChart.ChartView.Chart.Series.RemoveAllSeries(); var imageButton = ((((this.Children[0] as ContentPage).Content as ScrollView).Content as StackLayout).Children[1] as Grid).Children[2] as Button; switch (item) { case "AREA": Area area = new Area(); area.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(area); _customChart.ImageSource = dataPicker[0]; imageButton.Image = dataPicker[0]; break; #if !TEE_STD case "ARROW": Arrow arrow = new Arrow(); arrow.FillSampleValues(10); _customChart.ChartView.Chart.Series.Add(arrow); _customChart.ImageSource = dataPicker[1]; imageButton.Image = dataPicker[1]; break; #endif case "BAR": Bar bar = new Bar(); bar.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(bar); _customChart.ImageSource = dataPicker[2]; imageButton.Image = dataPicker[2]; break; #if !TEE_STD case "BARJOIN": BarJoin barjoin = new BarJoin(); barjoin.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(barjoin); _customChart.ImageSource = dataPicker[3]; imageButton.Image = dataPicker[3]; break; case "BEZIER": Bezier bezier = new Bezier(); bezier.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(bezier); _customChart.ImageSource = dataPicker[4]; imageButton.Image = dataPicker[4]; break; case "BOX": Box box = new Box(); box.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(box); _customChart.ImageSource = dataPicker[5]; imageButton.Image = dataPicker[5]; break; #endif case "BUBBLES": Bubble bubble = new Bubble(); bubble.FillSampleValues(7); _customChart.ChartView.Chart.Series.Add(bubble); _customChart.ImageSource = dataPicker[6]; imageButton.Image = dataPicker[6]; break; #if !TEE_STD case "CANDLE": Candle candle = new Candle(); candle.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(candle); _customChart.ImageSource = dataPicker[7]; imageButton.Image = dataPicker[7]; break; case "CONTOUR": Contour countour = new Contour(); countour.FillSampleValues(1); _customChart.ChartView.Chart.Series.Add(countour); _customChart.ImageSource = dataPicker[8]; imageButton.Image = dataPicker[8]; break; case "DARVAS": Darvas darvas = new Darvas(); darvas.FillSampleValues(3); _customChart.ChartView.Chart.Series.Add(darvas); _customChart.ImageSource = dataPicker[9]; imageButton.Image = dataPicker[9]; break; #endif case "DONUT": Donut donut = new Donut(); donut.FillSampleValues(1); _customChart.ChartView.Chart.Series.Add(donut); _customChart.ImageSource = dataPicker[10]; imageButton.Image = dataPicker[10]; break; #if !TEE_STD case "ERROR": Error error = new Error(); error.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(error); _customChart.ImageSource = dataPicker[11]; imageButton.Image = dataPicker[11]; break; case "ERRORBAR": ErrorBar errorbar = new ErrorBar(); errorbar.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(errorbar); _customChart.ImageSource = dataPicker[12]; imageButton.Image = dataPicker[12]; break; case "ERRORPOINT": ErrorPoint errorPoint = new ErrorPoint(); errorPoint.FillSampleValues(7); _customChart.ChartView.Chart.Series.Add(errorPoint); _customChart.ImageSource = dataPicker[13]; imageButton.Image = dataPicker[13]; break; #endif case "FASTLINE": FastLine fastLine = new FastLine(); fastLine.FillSampleValues(2); _customChart.ChartView.Chart.Series.Add(fastLine); _customChart.ImageSource = dataPicker[14]; imageButton.Image = dataPicker[14]; break; #if !TEE_STD case "HIGHLOW": HighLow highLow = new HighLow(); highLow.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(highLow); _customChart.ImageSource = dataPicker[15]; imageButton.Image = dataPicker[15]; break; case "HISTOGRAM": Histogram histogram = new Histogram(); histogram.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(histogram); _customChart.ImageSource = dataPicker[16]; imageButton.Image = dataPicker[16]; break; #endif case "HORIZAREA": HorizArea horizArea = new HorizArea(); horizArea.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizArea); _customChart.ImageSource = dataPicker[17]; imageButton.Image = dataPicker[17]; break; case "HORIZBAR": HorizBar horizBar = new HorizBar(); horizBar.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizBar); _customChart.ImageSource = dataPicker[18]; imageButton.Image = dataPicker[18]; break; case "HORIZLINE": HorizLine horizLine = new HorizLine(); horizLine.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(horizLine); _customChart.ImageSource = dataPicker[19]; imageButton.Image = dataPicker[19]; break; #if !TEE_STD case "ISOSURFACE": IsoSurface isoSurface = new IsoSurface(); isoSurface.FillSampleValues(10); _customChart.ChartView.Chart.Series.Add(isoSurface); _customChart.ImageSource = dataPicker[20]; imageButton.Image = dataPicker[20]; break; #endif case "LINE": Line line = new Line(); line.FillSampleValues(5); _customChart.ChartView.Chart.Series.Add(line); _customChart.ImageSource = dataPicker[21]; imageButton.Image = dataPicker[21]; break; #if !TEE_STD case "LINEPOINT": LinePoint linePoint = new LinePoint(); linePoint.FillSampleValues(6); _customChart.ChartView.Chart.Series.Add(linePoint); _customChart.ImageSource = dataPicker[22]; imageButton.Image = dataPicker[22]; break; #endif case "PIE": Pie pie = new Pie(); pie.FillSampleValues(4); _customChart.ChartView.Chart.Series.Add(pie); _customChart.ImageSource = dataPicker[23]; imageButton.Image = dataPicker[23]; break; #if !TEE_STD case "SURFACE": Surface surface = new Surface(); surface.FillSampleValues(10); //surface. _customChart.ChartView.Chart.Series.Add(surface); _customChart.ImageSource = dataPicker[24]; imageButton.Image = dataPicker[24]; break; case "TOWER": Tower tower = new Tower(); tower.FillSampleValues(8); _customChart.ChartView.Chart.Series.Add(tower); _customChart.ImageSource = dataPicker[25]; imageButton.Image = dataPicker[25]; break; case "VOLUME": Volume volume = new Volume(); volume.FillSampleValues(9); _customChart.ChartView.Chart.Series.Add(volume); _customChart.ImageSource = dataPicker[26]; imageButton.Image = dataPicker[26]; break; #endif } _customChart.ChartView.Chart.Axes.Left.Automatic = true; _customChart.ChartView.Chart.Axes.Bottom.Automatic = true; }
public bool CanMove(Arrow arrow) { switch (arrow) { case Arrow.LEFT: for (int j = 1; j < x; j++) { for (int i = 0; i < y; i++) { if (Blocks[i, j - 1].Value == 0) { return(true); } if (Blocks[i, j - 1].Value == Blocks[i, j].Value) { return(true); } } } break; case Arrow.RIGHT: for (int j = x - 2; j >= 0; j--) { for (int i = 0; i < y; i++) { if (Blocks[i, j + 1].Value == 0) { return(true); } if (Blocks[i, j + 1].Value == Blocks[i, j].Value) { return(true); } } } break; case Arrow.UP: for (int i = 1; i < x; i++) { for (int j = 0; j < y; j++) { if (Blocks[i - 1, j].Value == 0) { return(true); } if (Blocks[i - 1, j].Value == Blocks[i, j].Value) { return(true); } } } break; case Arrow.DOWN: for (int i = x - 2; i >= 0; i--) { for (int j = 0; j < y; j++) { if (Blocks[i + 1, j].Value == 0) { return(true); } if (Blocks[i + 1, j].Value == Blocks[i, j].Value) { return(true); } } } break; } return(false); }
void Update() { // 좌클릭하면 회전시작 if (isPlay) { if (Input.GetKeyDown(KeyCode.Mouse0)) { isRotating = true; RotateInit(); } // 변, 각, 무기 Effect ClearWeaponEffect(); if (!isRotating) { ClearTri(); switch (Tstate) { case 0: if (onHypo) { HypoEffect.SetActive(true); } else if (onHeight && isCo) { HeightEffect.SetActive(true); } else if (onBase && !isCo) { BaseEffect.SetActive(true); } break; case 1: if (onHypo) { HypoDeleteEffect.SetActive(true); } else if (onHeight && !isCo) { BowEffect.SetActive(true); ArrowEffect.SetActive(true); BaseLineEffect.SetActive(true); } else if (onBase && isCo) { CoBowEffect.SetActive(true); CoArrowEffect.SetActive(true); HeightLineEffect.SetActive(true); } break; case 2: if (onHeight) { HeightDeleteEffect.SetActive(true); } else if (onHypo && isCo) { CoSpearEffect.SetActive(true); HypoCoLineEffect.SetActive(true); } else if (onBase && isCo) { CoShieldEffect.SetActive(true); } break; case 3: if (onBase) { BaseDeleteEffect.SetActive(true); } else if (onHypo && !isCo) { SpearEffect.SetActive(true); HypoIdleLineEffect.SetActive(true); } else if (onHeight && !isCo) { ShieldEffect.SetActive(true); } break; } if (onCoAngle) { if (isCo) { CoAngleDeleteEffect.SetActive(true); } else if (!isCo) { CoAngleEffect.SetActive(true); } } if (onIdleAngle && isCo) { CoAngleDeleteEffect.SetActive(true); IdleAngleEffect.SetActive(true); } } // 키보드'space' or CoAngle 클릭시 if (Input.GetKeyDown(KeyCode.Space) || (Input.GetKeyDown(KeyCode.Mouse0) && onCoAngle)) { isCo = !isCo; } // Co상태에서 IdleAngle 클릭시 if (isCo && Input.GetKeyDown(KeyCode.Mouse0) && onIdleAngle) { isCo = false; } if (isCo) { CoAngle.SetActive(true); } else { CoAngle.SetActive(false); } // 키보드'w' or Hypo 클릭시 if (Input.GetKeyDown(KeyCode.W) || (Input.GetKeyDown(KeyCode.Mouse0) && onHypo)) { switch (Tstate) { case 0: Tstate = 1; if (!isCo) { MakeCircle(HypoIdleCircle); } else { MakeCircle(HypoCoCircle); } break; case 1: Tstate = 0; HypoIdleCircle.SetActive(false); HypoCoCircle.SetActive(false); break; case 2: if (isCo) { if (Input.GetKeyDown(KeyCode.W)) { SetAnimationParameters(0, 1); StartCoroutine("Cosec"); RotateFinish(); } else { CoSpear.SetActive(true); isLaunching = 5; } } break; case 3: if (!isCo) { if (Input.GetKeyDown(KeyCode.W)) { SetAnimationParameters(0, 1); StartCoroutine("Sec"); RotateFinish(); } else { Spear.SetActive(true); isLaunching = 2; } } break; } } // 키보드'd' or Height 클릭시 if (Input.GetKeyDown(KeyCode.D) || (Input.GetKeyDown(KeyCode.Mouse0) && onHeight)) { switch (Tstate) { case 0: MakeCircle(HeightCircle); Tstate = 2; break; case 1: if (!isCo) { if (Input.GetKeyDown(KeyCode.D)) { SetAnimationParameters(0, 1); StartCoroutine("Sin"); RotateFinish(); } else { Bow.SetActive(true); Arrow.SetActive(true); isLaunching = 1; } } break; case 2: Tstate = 0; HeightCircle.SetActive(false); break; case 3: if (!isCo) { if (Input.GetKeyDown(KeyCode.D)) { SetAnimationParameters(0, 1); StartCoroutine("Tan"); RotateFinish(); } else { Shield.SetActive(true); isLaunching = 3; } } break; } } // 키보드'a' or Base 클릭시 if (Input.GetKeyDown(KeyCode.A) || (Input.GetKeyDown(KeyCode.Mouse0) && onBase)) { switch (Tstate) { case 0: MakeCircle(BaseCircle); Tstate = 3; break; case 1: if (isCo) { if (Input.GetKeyDown(KeyCode.A)) { SetAnimationParameters(0, 1); StartCoroutine("Cos"); RotateFinish(); } else { CoBow.SetActive(true); CoArrow.SetActive(true); isLaunching = 4; } } break; case 2: if (isCo) { if (Input.GetKeyDown(KeyCode.A)) { SetAnimationParameters(0, 1); StartCoroutine("Cotan"); RotateFinish(); } else { CoShield.SetActive(true); isLaunching = 6; } } break; case 3: Tstate = 0; BaseCircle.SetActive(false); break; } } ClearEdgeActivated(); switch (Tstate) { case 0: Tri.transform.localScale = StandardScale; break; case 1: HypoActivated.SetActive(true); HypoLength.SetActive(true); Tri.transform.localScale = StandardScale * 0.807f; break; case 2: HeightActivated.SetActive(true); HeightLength.SetActive(true); Tri.transform.localScale = StandardScale * 1.365f; break; case 3: BaseActivated.SetActive(true); BaseLength.SetActive(true); Tri.transform.localScale = StandardScale; break; } // 마우스 떼면 회전종료 if (Input.GetKeyUp(KeyCode.Mouse0)) { isRotating = false; if (isLaunching != 0) { switch (isLaunching) { case 1: StartCoroutine("Sin"); break; case 2: StartCoroutine("Sec"); break; case 3: StartCoroutine("Tan"); break; case 4: StartCoroutine("Cos"); break; case 5: StartCoroutine("Cosec"); break; case 6: StartCoroutine("Cotan"); break; } RotateFinish(); } } if (isRotating) { MousePresentPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition) - CoR; // 마우스 현재위치는 깨다 기준 상대적 위치 RotateAngle = Vector2.Angle(MouseStartPosition, MousePresentPosition); // RotateAngle 계산 // Vertor2.Angle은 항상 0<=Angle<180이므로 외적을 이용해서 반환 if (Vector3.Cross(MouseStartPosition, MousePresentPosition).z < 0) { RotateAngle = 360f - RotateAngle; } // 회전 및 삼각형 중심 - 회전 중심 위치 조정 Tri.transform.rotation = TriStartRotation * Quaternion.Euler(Vector3.forward * RotateAngle); // Hypo, Height, Base Length 같이 회전 (역방향) HypoLength.transform.rotation = Quaternion.Euler(-(Tri.transform.rotation * Vector3.forward)); HeightLength.transform.rotation = Quaternion.Euler(-(Tri.transform.rotation * Vector3.forward)); BaseLength.transform.rotation = Quaternion.Euler(-(Tri.transform.rotation * Vector3.forward)); Tri.transform.position = Quaternion.Euler(Vector3.forward * RotateAngle) * TriStartPosition + CoR; } if (Input.GetKeyDown(KeyCode.Mouse1)) { Reset(); } // 우클릭 시 초기화 } }
public void Move(Arrow arrow) { switch (arrow) { #region LEFT case Arrow.LEFT: for (int j = 0; j < x; j++) { for (int i = 0; i < y; i++) { if (j > 0) { if (Blocks[i, j - 1].Value == 0) { int lastNull = j - 1; for (int _j = j - 1; _j >= 0; _j--) { if (Blocks[i, _j].Value == 0) { lastNull = _j; } else { break; } } if (lastNull != 0 && Blocks[i, lastNull - 1].Value == Blocks[i, j].Value) { Blocks[i, lastNull - 1].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } else { Blocks[i, lastNull].Value = Blocks[i, j].Value; Blocks[i, j].Value = 0; } } else if (Blocks[i, j - 1].Value == Blocks[i, j].Value) { Blocks[i, j - 1].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } } } } break; #endregion #region RIGHT case Arrow.RIGHT: for (int j = x - 1; j >= 0; j--) { for (int i = 0; i < y; i++) { if (j < x - 1) { if (Blocks[i, j + 1].Value == 0) { int lastNull = j + 1; for (int _j = j + 1; _j < x; _j++) { if (Blocks[i, _j].Value == 0) { lastNull = _j; } else { break; } } if (lastNull != x - 1 && Blocks[i, lastNull + 1].Value == Blocks[i, j].Value) { Blocks[i, lastNull + 1].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } else { Blocks[i, lastNull].Value = Blocks[i, j].Value; Blocks[i, j].Value = 0; } } else if (Blocks[i, j + 1].Value == Blocks[i, j].Value) { Blocks[i, j + 1].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } } } } break; #endregion #region UP case Arrow.UP: for (int i = 0; i < x; i++) { for (int j = 0; j < y; j++) { if (i > 0) { if (Blocks[i - 1, j].Value == 0) { int lastNull = i - 1; for (int _i = i - 1; _i >= 0; _i--) { if (Blocks[_i, j].Value == 0) { lastNull = _i; } else { break; } } if (lastNull != 0 && Blocks[lastNull - 1, j].Value == Blocks[i, j].Value) { Blocks[lastNull - 1, j].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } else { Blocks[lastNull, j].Value = Blocks[i, j].Value; Blocks[i, j].Value = 0; } } else if (Blocks[i - 1, j].Value == Blocks[i, j].Value) { Blocks[i - 1, j].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } } } } break; #endregion #region DOWN case Arrow.DOWN: for (int i = x - 1; i >= 0; i--) { for (int j = 0; j < y; j++) { if (i < x - 1) { if (Blocks[i + 1, j].Value == 0) { int lastNull = i + 1; for (int _i = i + 1; _i < x; _i++) { if (Blocks[_i, j].Value == 0) { lastNull = _i; } else { break; } } if (lastNull != x - 1 && Blocks[lastNull + 1, j].Value == Blocks[i, j].Value) { Blocks[lastNull + 1, j].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } else { Blocks[lastNull, j].Value = Blocks[i, j].Value; Blocks[i, j].Value = 0; } } else if (Blocks[i + 1, j].Value == Blocks[i, j].Value) { Blocks[i + 1, j].Value = Blocks[i, j].Value * 2; Blocks[i, j].Value = 0; } } } } break; #endregion } if (!CheckGameOver() && CanMove(arrow)) { SetRandomValue(1); } Debug(arrow); }
public void Shoot(Vector2 start, Vector2 direction) { Arrow = Instantiate(ArrowPrefab, start, Quaternion.identity); Arrow.GetComponent <Rigidbody2D>().AddForce(direction * 20f, ForceMode2D.Impulse); Arrow.GetComponent <Arrow>().playerNo = equipPlayer.playerNo; }
// TODO: Need some sort of hashmap from binding handles to Binding objects public static BindingHandle CreateBinding <A, B>(Bindable source, string sourceProperty, Arrow <A, B> arrow, Bindable destination, string destinationProperty) { BindPoint sourcePoint = new BindPoint(source, sourceProperty); BindPoint destinationPoint = new BindPoint(destination, destinationProperty); return(CreateBinding(sourcePoint, arrow, destinationPoint)); }
//Read User Key static void ReadUserKey() { if (Console.KeyAvailable) { ConsoleKeyInfo keyInfo = Console.ReadKey(true); //Declare movement if (keyInfo.Key == ConsoleKey.UpArrow) { previousPosition = new Position(player.X, player.Y); player.X = player.X; player.Y = player.Y - 1; currentDirection = "up"; } else if (keyInfo.Key == ConsoleKey.DownArrow) { previousPosition = new Position(player.X, player.Y); player.X = player.X; player.Y = player.Y + 1; currentDirection = "down"; } else if (keyInfo.Key == ConsoleKey.RightArrow) { previousPosition = new Position(player.X, player.Y); player.X = player.X + 1; player.Y = player.Y; currentDirection = "right"; } else if (keyInfo.Key == ConsoleKey.LeftArrow) { previousPosition = new Position(player.X, player.Y); player.X = player.X - 1; player.Y = player.Y; currentDirection = "left"; } //Declare Attack else if (keyInfo.Key == ConsoleKey.Z) { switch (currentDirection) { case "up": attackedPosition.X = player.X; attackedPosition.Y = player.Y - 1; break; case "down": attackedPosition.X = player.X; attackedPosition.Y = player.Y + 1; break; case "right": attackedPosition.X = player.X + 1; attackedPosition.Y = player.Y; break; case "left": attackedPosition.X = player.X - 1; attackedPosition.Y = player.Y; break; } if (attackedPosition.X >= 0 && attackedPosition.X < BoardWidth && attackedPosition.Y >= 0 && attackedPosition.Y < BoardHeight && terrainPositions[attackedPosition.X, attackedPosition.Y] == false) { hasAttacked = true; if (hasBow) { Arrow newArrow = new Arrow(attackedPosition.X, attackedPosition.Y, currentDirection); arrows.Add(newArrow); previousArrowPosition.Add(new Position(attackedPosition.X, attackedPosition.Y)); } } } } }
public void StartMove(Vector2 localTouchPos, Arrow touchingArrow) { currentDirection = touchingArrow == null ? Vector2.zero : (Vector2)(touchingArrow.point.position - transform.position); }
void Start () { /* _cop._triggerback += delegate(Collider other) { Debug.Log("eat:" + other.gameObject.name); ChildCtrl childCtrl = other.gameObject.GetComponent<ChildCtrl>(); //HashSet ChildCtrl cc =_childList.Find(delegate(ChildCtrl obj) { if(obj == childCtrl){ return true; } return false; }); if(cc == null){ _childList.Add(childCtrl); } };*/ _arrow = Arrow.Right; fsm_.addState ("stop", getStopState()); fsm_.addState("walk", getWalkState()); fsm_.addState("test", getTestState()); fsm_.init ("stop"); }
public static void blah() { Arrow <int, string> test = Op.Arr((int x) => x + 1).Combine(Op.Arr((int x) => x.ToString())); Arrow <int, string> test1 = Op.Combine(Op.Arr((int x) => x + 1), Op.Arr((int x) => x.ToString())); }
public void Add(Arrow a) { List.Add(a); }
public static void Analyze(Analysis Mna, Node Anode, Node Cathode, Expression Current, Arrow InitialConditions) { Analyze(Mna, Anode, Cathode, Current); Mna.AddInitialConditions(InitialConditions); }