private void CreateBall(GameEntity track, GameEntity chain, float distance) { // TODO: if will error - replace zero to some more useful //var pathCreator // continue point Transform ball = pool.RealeseObject(Vector3.zero, Quaternion.identity, normalScale).transform; ColorBall colorType = track.randomizer.value.GetRandomColorType(); GameEntity entityBall = _contexts.game.CreateEntity(); entityBall.AddBallId(Extensions.BallId); entityBall.AddDistanceBall(distance); entityBall.AddTransform(ball); entityBall.AddSprite(ball.GetComponent <SpriteRenderer>()); entityBall.AddColor(colorType); entityBall.AddParentChainId(chain.chainId.value); ball.tag = Constants.BALL_TAG; ball.gameObject.Link(entityBall, _contexts.game); if (_contexts.global.isDebugAccess) { _contexts.manage.CreateEntity() .AddLogMessage($" ___ Created new ball in chain: {entityBall.ToString()}", TypeLogMessage.Trace, false, GetType()); } }
private void ConvertProjectileToBall(GameEntity entity, int chainId, float distanceBall, PathCreator pathCreator, Action postChainAction) { if (_contexts.global.isDebugAccess) { _contexts.manage.CreateEntity() .AddLogMessage($" ___ Convert projectile to ball. projectile: {entity.ToString()}", TypeLogMessage.Trace, false, GetType()); } entity.isProjectile = false; entity.RemoveForce(); entity.RemoveRayCast(); entity.transform.value.tag = Constants.BALL_TAG; entity.AddDistanceBall(distanceBall); entity.AddBallId(Extensions.BallId); entity.AddParentChainId(chainId); entity.isAddedBall = true; Vector3 target = pathCreator.path.GetPointAtDistance(distanceBall, EndOfPathInstruction.Stop); postChainAction += delegate() { entity.isCheckTargetBall = true; _contexts.manage.shootInRowCombo.isProjectile = true; if (_contexts.global.isDebugAccess) { _contexts.manage.CreateEntity() .AddLogMessage($" ___ Ending animation inserting. Mark ball as inserted ball: {entity.ToString()}", TypeLogMessage.Trace, false, GetType()); } }; entity.AddMoveAnimation(insertDuration, target, postChainAction); }