public Player(IBoard board, ConsoleColor colorOfCheckers) { ColorOfCheckers = colorOfCheckers; MovementOptions = Movement.RollDice; Dice = new[] { 0, 0, 0, 0 }; _arrow = new Arrow(board, this); }
public RenderDataCache(double pathThickness, bool selected, GeneralPath generalPath, IArrow arrows) { PathThickness = pathThickness; Selected = selected; GeneralPath = generalPath; Arrows = arrows; }
public virtual void ReleaseArrow(Vector3 direction) { if (!releaseArrow) { DestroyArrow(); return; } if (ArrowInstance == null) { return; } ArrowInstance.transform.parent = null; IArrow arrow = ArrowInstance.GetComponent <IArrow>(); arrow.HitMask = HitLayer; //Transfer the same Hit Mask to the Arrow arrow.TriggerInteraction = TriggerInteraction; //Link the Trigger Interatction arrow.Damage = Mathf.Lerp(MinDamage, MaxDamage, BowTension); arrow.ShootArrow(Mathf.Lerp(MinForce, MaxForce, BowTension), direction.normalized); OnReleaseArrow.Invoke(ArrowInstance); ArrowInstance = null; }
public static IArrow First <C>(this IArrow arr) { /* * A slightly messy way of simplifying First using the IArrow interface and determining * the types of the input arrow at runtime, so that it doesn't take three type * parameters. * Horrific code btw. */ Type a = arr.a; Type b = arr.b; Type c = typeof(C); Type inputTupleType = typeof(Tuple <,>).MakeGenericType(a, c); Type outputTupleType = typeof(Tuple <,>).MakeGenericType(b, c); Type resultType = typeof(Arrow <,>).MakeGenericType(inputTupleType, outputTupleType); Type funcType = typeof(Func <,>).MakeGenericType(inputTupleType, outputTupleType); Type[] constructorTypes = new Type[1]; constructorTypes[0] = funcType; ConstructorInfo constructor = resultType.GetConstructor(constructorTypes); dynamic[] parameters = new dynamic[1]; parameters[0] = new Func <Tuple <dynamic, dynamic>, Tuple <dynamic, dynamic> >((Tuple <dynamic, dynamic> x) => new Tuple <dynamic, dynamic>(arr.Invoke(x.Item1), x.Item2)); return((IArrow)constructor.Invoke(parameters)); }
public virtual void CheckAndClearNockedArrow(IArrow arrow) { if (thisNockedArrow == arrow) { thisNockedArrow = null; } }
/* Hit & arrow interaction */ public void Hit( IArrow arrow, bool crit ) { float attack = arrow.GetAttack(); float critBonus = 0f; if (crit) { critBonus = attack * (thisShootingManager.GetCriticalMultiplier() - 1f); } thisHealth -= Mathf.FloorToInt(attack + critBonus); if (thisHealth <= 0f) { DestroyTarget(); } else { IndicateHealth( thisHealth, attack + critBonus ); IndicateHit( attack, critBonus ); } if (crit) { thisShootingManager.Flash(); } }
public void NockArrow() { if (thisNockedArrow == null) { IArrow nextArrow = thisArrowReserve.GetNextArrow(); nextArrow.Nock(); } }
public ConstArg( IArrow arrow, IArrowStateEngine engine ) { thisArrow = arrow; thisEngine = engine; }
public RenderDataCache(double pathThickness, bool selected, GeneralPath generalPath, IArrow arrows, long obstacleHash) { this.obstacleHash = obstacleHash; PathThickness = pathThickness; Selected = selected; GeneralPath = generalPath; Arrows = arrows; }
public static Vector2 GetDirection(IArrow arrow) { var arrowObject = (Arrow) arrow; var actualDirection = arrowObject.Vertices()[1].Position - arrowObject.Vertices()[0].Position; actualDirection.Normalize(); return actualDirection.DiscardZComponent(); }
public void Detach() { SetParent(null); if (thisTargetArrow != null) { thisTargetArrow.CheckAndClearArrowTrail(this); } thisTargetArrow = null; }
public void ActivateAt(IArrow arrow) { Deactivate(); SetParent(arrow); thisTargetArrow = arrow; ResetLocalTransform(); arrow.SetArrowTrail(this); Activate(); }
public void ClearAndDeactivateShotInBuffer() { if (thisShotInBuffer != null) { IArrow arrow = thisShotInBuffer.GetArrow(); arrow.Deactivate(); thisShotInBuffer = null; } }
public static void CheckColour(IArrow arrow, Color color) { var arrowObject = (Arrow) arrow; Assert.AreEqual(Color.Transparent, arrowObject.Vertices()[0].Color); Assert.AreEqual(color, arrowObject.Vertices()[1].Color); Assert.AreEqual(color, arrowObject.Vertices()[2].Color); Assert.AreEqual(color, arrowObject.Vertices()[3].Color); Assert.AreEqual(color, arrowObject.Vertices()[4].Color); Assert.AreEqual(color, arrowObject.Vertices()[5].Color); }
public static float GetLength(IArrow arrow) { var arrowObject = (Arrow) arrow; var x0 = arrowObject.Vertices()[0].Position.X; var y0 = arrowObject.Vertices()[0].Position.Y; var x3 = arrowObject.Vertices()[3].Position.X; var y3 = arrowObject.Vertices()[3].Position.Y; return new Vector2(x3 - x0, y3 - y0).Length(); }
/* Release */ public void Release() { if (thisAimIsDone) { IArrow arrow = thisNockedArrow; thisNockedArrow = null; arrow.SetNormalizedDraw(thisNormalizedDrawTime); arrow.SetAttack(thisArrowAttack); arrow.Release(); StopDraw(); // thisArrowTrailReserve.ActivateTrailAt(arrow); } }
public virtual void RegisterShot(IArrow arrow) { if (thisShotInBuffer == null) { thisShotInBuffer = new Shot(arrow); if (thisShootingProcess == null) { thisShootingProcess = thisSlickBowShootingProcessFactory.CreateShootingProcess( this, thisFireRate ); thisShootingProcess.Run(); } } }
void ExecuteShot() { IShot shotInBuffer = thisShootingManager.GetShotInBuffer(); if (shotInBuffer != null) { IArrow arrow = shotInBuffer.GetArrow(); arrow.StartFlight(); thisShootingManager.ClearShotBuffer(); } else { this.Expire(); } }
public override void Hit(IArrow arrow) { Vector3 arrowPrevPosition = arrow.GetPrevPosition(); RaycastHit critHit; Vector3 direction = arrow.GetPosition() - arrowPrevPosition; bool hasCritHit = Physics.Raycast( arrowPrevPosition, direction, out critHit, 10f, thisLayerMask ); thisShootingTarget.Hit(arrow, hasCritHit); }
public void ActivateTrailAt( IArrow arrow, float normalizedDraw ) { IArrowTrail next = GetNext(); next.ActivateAt(arrow); Color trailColor = Color.Lerp( thisMinDrawColor, thisMaxDrawColor, normalizedDraw ); next.SetColor(trailColor); }
/// <summary> /// Create an arrow ready to shooot /// </summary> public virtual void EquipArrow() { if (currentArrow != null) { return; //If there is no arrow in the game object slot ignore } currentArrow = (GameObject)Instantiate(Arrow, KNot); //Instantiate the Arrow in the Knot of the Bow currentArrow.transform.localPosition = Vector3.zero; //Reset Position currentArrow.transform.localRotation = Quaternion.identity; //Reset Rotation IArrow arrow = currentArrow.GetComponent <IArrow>(); //Get the IArrow Component if (arrow != null) { currentArrow.transform.Translate(0, 0, arrow.TailOffset, Space.Self); //Translate in the offset of the arrow to put it on the hand } OnLoadArrow.Invoke(currentArrow); }
string GetArrowStateString(IArrow arrow) { ArrowStateEngine.IState state = arrow.GetCurrentState(); string result = state.GetName(); IArrowReserve reserve = arrowReserveAdaptor.GetArrowReserve(); if (!(state is ArrowStateEngine.NockedState)) { if (state is ArrowStateEngine.FlightState) { result += ": " + reserve.GetIndexInFlight(arrow); } else { result += ": " + reserve.GetIndexInReserve(arrow); } } return(result); }
public virtual void ReleaseArrow(Vector3 direction) { if (ArrowInstance == null) { return; } ArrowInstance.transform.parent = null; IArrow arrow = ArrowInstance.GetComponent <IArrow>(); arrow.HitMask = HitMask; //Transfer the same Hit Mask arrow.ShootArrow(Mathf.Lerp(MinForce, MaxForce, BowTension), direction); arrow.Damage = Mathf.Lerp(MinDamage, MaxDamage, BowTension); OnReleaseArrow.Invoke(ArrowInstance); ArrowInstance = null; }
public IArrowFlightProcess CreateArrowFlightProcess( IArrow arrow, float flightSpeed, Vector3 flightDirection, float flightGravity, Vector3 launcherVelocity, Vector3 launchPosition, float flightTime ) { ArrowFlightProcess.IConstArg arg = new ArrowFlightProcess.ConstArg( arrow, flightSpeed, flightDirection, flightGravity, launcherVelocity, launchPosition, thisProcessManager, flightTime ); return(new ArrowFlightProcess(arg)); }
public ConstArg( IArrow arrow, float flightSpeed, Vector3 flightDirection, float flightGravity, Vector3 launcherVelocity, Vector3 launchPosition, IProcessManager processManager, float flightTime //4 ) : base( processManager, ProcessConstraint.ExpireTime, flightTime ) { thisArrow = arrow; thisFlightSpeed = flightSpeed; thisFlightDirection = flightDirection; thisFlightGravity = flightGravity; thisLauncherVelocity = launcherVelocity; thisLaunchPosition = launchPosition; }
public ConstArg( IArrow arrow ) { thisArrow = arrow; }
public override void Hit(IArrow arrow) { return; }
public static Vector2 GetPosition(IArrow arrow) { var arrowObject = (Arrow)arrow; return new Vector2(arrowObject.Vertices()[0].Position.X, arrowObject.Vertices()[0].Position.Y); }
public override void RegisterShot(IArrow arrow) { }
public override void SetNockedArrow(IArrow arrow) { }
protected virtual void RenderArrows(IRenderContext context, Graphics graphics, IEdge edge, GeneralPath edgePath, IArrow sourceArrow, IArrow targetArrow) { if (targetArrow != Arrows.None && targetArrow != null) { Tangent?targetArrowAnchor = GetTargetArrowAnchor(edgePath, targetArrow); if (targetArrowAnchor != null) { var anchorPoint = targetArrowAnchor.Value.Point; var arrowDirection = targetArrowAnchor.Value.Vector; IVisualCreator visualCreator = targetArrow.GetVisualCreator(edge, false, anchorPoint, arrowDirection); visualCreator.CreateVisual(context).Paint(context, graphics); } } if (sourceArrow != Arrows.None && sourceArrow != null) { Tangent?sourceArrowAnchor = GetSourceArrowAnchor(edgePath, sourceArrow); if (sourceArrowAnchor != null) { var anchorPoint = sourceArrowAnchor.Value.Point; var arrowDirection = sourceArrowAnchor.Value.Vector; var visualCreator = sourceArrow.GetVisualCreator(edge, true, anchorPoint, arrowDirection); visualCreator.CreateVisual(context).Paint(context, graphics); } } }
protected virtual void CropPath(IEdge edge, IArrow sourceArrow, IArrow targetArrow, ref GeneralPath pathToCrop) { pathToCrop = base.CropPath(edge, sourceArrow, targetArrow, pathToCrop); }
public override void CheckAndClearNockedArrow(IArrow arrow) { }
public ArrowValueConverter(IArrow arrow) { this.arrow = arrow; }
public RenderDataCache(double pathThickness, GeneralPath generalPath, IArrow arrows) { this.PathThickness = pathThickness; this.GeneralPath = generalPath; this.Arrows = arrows; }