Exemple #1
0
 private void OnMessage(Messages.Param param)
 {
     if (param.Is(Messages.Type.BallPurchased))
     {
         UpdateState();
     }
 }
Exemple #2
0
 private void OnMessage(Messages.Param param)
 {
     if (param.Is(Messages.Type.TurnEnded))
     {
         isShooting = false;
     }
 }
Exemple #3
0
 private void OnMessage(Messages.Param param)
 {
     if (param.Is(Messages.Type.AvatarChanged))
     {
         UpdateVisual();
     }
 }
Exemple #4
0
 private void OnMessage(Messages.Param param)
 {
     if (param.Is(Messages.Type.AvatarChanged))
     {
         avatar.Setup(Profile.Avatar.Current);
     }
 }
Exemple #5
0
    private void OnMessage(Messages.Param param)
    {
        if (PlayModel.level.targetItem0 < 1 && PlayModel.level.targetItem1 < 1)
        {
            return;
        }

        if (param.Is(Messages.Type.BlockDead) && param.Is <BlockValue>())
        {
            var subject = param.As <BlockValue>();
            if (PlayModel.level.targetItem0 > 0 && subject.ItemIndex == 0)
            {
                StartCoroutine(DoMoveToMissionUi(subject.transform, item0Image.transform.position));
            }
            else if (PlayModel.level.targetItem1 > 0 && subject.ItemIndex == 1)
            {
                StartCoroutine(DoMoveToMissionUi(subject.transform, item1Image.transform.position));
            }
        }
    }
Exemple #6
0
    public void OnMessage(Messages.Param param)
    {
        switch (param.type)
        {
        case Messages.Type.OnBlockHit:
        {
            if (param.Is <BlockBase>())
            {
                DispatchOnBlockHit(param.As <BlockBase>().Type);
            }
        }
        break;

        case Messages.Type.OnBlockDeath:
        {
            if (param.Is <BlockBase>())
            {
                DispatchOnBlockDeath(param.As <BlockBase>().Type);
            }
        }
        break;
        }
    }
Exemple #7
0
    private void OnMessage(Messages.Param param)
    {
        switch (param.type)
        {
        case Messages.Type.StartTurn:
        {
            turnStarted = true;
            float speed = GlobalConfig.Difficulty.startBallSpeed;
            if (BlockManager.blocks.Count < 16)
            {
                speed += speed * (16 - BlockManager.blocks.Count) * 0.05f;
            }
            StartCoroutine(DoStartTurn(param.As <Vector3>().normalized *speed));
            transform.root.Broadcast(Messages.Type.TurnStarted, this);
        }
        break;

        case Messages.Type.EndTurn:
        {
            StopAllCoroutines();
            ballsShooting = false;
            CheckAllBalls();
        }
        break;

        case Messages.Type.BlockDead:
        {
            if (param.Is <BlockBall>())
            {
                var ball = param.As <BlockBall>();
                if (ball.IsPregnant)
                {
                    var newball = SpawnBall(ball.transform.localPosition);
                    newball.Rigidbody.velocity = GlobalConfig.Difficulty.startBallSpeed * new Vector2(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f)).normalized;
                }
            }
        }
        break;
        }
    }