/// <summary> /// Set all prerequisites as parents of this node, and for each parent set this node as a child. /// </summary> public void CreateLinks() { if (Research.prerequisites.NullOrEmpty()) { return; } // 'vanilla' prerequisites foreach (ResearchProjectDef prerequisite in Research.prerequisites) { // skip self prerequisite if (prerequisite != Research) { Node parent = prerequisite.Node(); if (parent != null) { Above.Add(parent); } } } foreach (Node parent in Above) { parent.Below.Add(this); } }
protected override void PerformDashAction() //STUN { if (!CanMove) { return; } Collider[] hits = Physics.OverlapBox(grabHitbox.transform.TransformPoint(grabHitbox.center), grabHitbox.bounds.extents); foreach (Collider h in hits) { Player other = h.GetComponent <Player>(); if (other != null && other != this && other.Team != this.Team) //first check if you collide with opposing player { if (Above != null && !Above.HasBall && other.GetComponent <TallPlayer>() != null) //now check for powerstun (if your smallplayer doesnt have the ball and the opponent is a tallplayer) { if (other.GetComponent <TallPlayer>().Above != null) // if that tall player has a smallplayer above them then powerstun and steal { Above.Steal(); other.Stun(powerStunTime); } } else //you just collide with another player { other.Stun(regStunTime); } SoundManager.Instance.Play(successfulStun); } } }
public override void Stun(float stunTime) { base.Stun(stunTime); if (Above != null) { Above.Stun(stunTime); } }
public bool ThrowSmallPlayer() { if (Above == null || !Above.OnThrown(XLook, ZLook)) { return(false); } Above = null; return(true); }
// If s is immediately adjacent to (shares a border with) us, then add it to the // appropriate direction list. If s is not "touching" us, then it will not get added to // any list. s can be added to at most one list (hence use of "else if" instead of just // a sequence of "if's"). public void AddDirectionTo(SnagScreen s) { if ((R.Right == s.R.Left) && OverlapY(R, s.R)) { ToRight.Add(s); } else if ((R.Left == s.R.Right) && OverlapY(R, s.R)) { ToLeft.Add(s); } else if ((R.Top == s.R.Bottom) && OverlapX(R, s.R)) { Above.Add(s); } else if ((R.Bottom == s.R.Top) && OverlapX(R, s.R)) { Below.Add(s); } }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { // Use this method for calculating your indicator values. Assign a value to each // plot below by replacing 'Close[0]' with your own formula. if (CurrentBar < period) { return; } double value = CCI(period)[0]; if (value > 200) { BackColor = Color.PaleGreen; BarColor = Color.Yellow; CandleOutlineColor = Color.Black; } else if (value > 150) { BackColor = Color.PaleGreen; } else if (value < -200) { BackColor = Color.Pink; BarColor = Color.Yellow; CandleOutlineColor = Color.Black; } else if (value < -150) { BackColor = Color.Pink; } Above.Set(value); Neutral.Set(value); Below.Set(value); }
/// <summary> /// Links both <see cref="Display"/>s if they are adjacent. Does nothing otherwise. /// Adjacent means that both <see cref="Display"/>s share a border /// The <see cref="Display"/> passed in will be added to at most one List (<see cref="ToLeft"/>, <see cref="ToRight"/>, <see cref="Above"/>, <see cref="Below"/>) /// </summary> /// <param name="display"></param> public void Link(Display display) { if (display == null) { throw new ArgumentNullException(nameof(display)); } if ((Bounds.Right == display.Bounds.Left) && GeometryUtil.OverlapY(Bounds, display.Bounds)) { ToRight.Add(display); } else if ((Bounds.Left == display.Bounds.Right) && GeometryUtil.OverlapY(Bounds, display.Bounds)) { ToLeft.Add(display); } else if ((Bounds.Top == display.Bounds.Bottom) && GeometryUtil.OverlapX(Bounds, display.Bounds)) { Above.Add(display); } else if ((Bounds.Bottom == display.Bounds.Top) && GeometryUtil.OverlapX(Bounds, display.Bounds)) { Below.Add(display); } }
public bool IsOnTop() { return(Above.Any(x => x.Removed == false) == false); }