private void BoosterTrigger()
    {
        BoosterController booster      = currentTrigger.GetComponent <BoosterController>();
        float             boost        = booster.boost;
        float             deceleration = booster.deceleration;
        Vector2           boosterDir   = booster.transform.right;

        if (!booster.directionRight)
        {
            boosterDir *= -1;
        }
        float angle = Vector2.SignedAngle(boosterDir, bike.velocity);

        if (angle > 90 || angle < -90)
        {
            bike.velocity          *= deceleration;
            wheel1.velocity         = bike.velocity;
            wheel2.velocity         = bike.velocity;
            wheel1.angularVelocity *= deceleration;
            wheel2.angularVelocity *= deceleration;
            return;
        }

        bike.velocity          *= boost;
        wheel1.velocity         = bike.velocity;
        wheel2.velocity         = bike.velocity;
        wheel1.angularVelocity *= boost;
        wheel2.angularVelocity *= boost;
    }
    // Use this for initialization
    void Start()
    {
        booster     = transform.parent.GetComponent <BoosterController>();
        psComponent = GetComponent <ParticleSystem>();
        var em = psComponent.emission;

        startEmission = em.rateOverTime.constant;
    }
    public void EatBooster(BoosterController booster, LetterController dragedLetter)
    {
//		Debug.Log ("EatBooster " + booster.Model.Type);
        switch (booster.Model.Type)
        {
        case Booster.BoosterType.FireWrongLetter:
            GameplayController.Instance.DoFireBooster(booster, dragedLetter);
            break;

        case Booster.BoosterType.FreezeTime:
            GameplayController.Instance.DoFreezeBooster();
            break;

        case Booster.BoosterType.LoseSegment:
            GameplayController.Instance.SegmentLose();
            break;

        case Booster.BoosterType.MagnetLetter:
            GameplayController.Instance.DoMagnetBooster(booster, dragedLetter);
            break;

        case Booster.BoosterType.SlowMovment:
            GameplayController.Instance.SlowMovmentBooster(booster, dragedLetter);
            break;

        case Booster.BoosterType.ShowCallout:
            GameplayController.Instance.ShowCalloutBooster(booster, dragedLetter);
            break;

        case Booster.BoosterType.Shield:
            GameplayController.Instance.ShieldBooster(booster, dragedLetter);
            break;


        case Booster.BoosterType.BonusLetter:
            //booster.addScorebubble (600);
            GameplayController.Instance.DoBounsLetterBooster(booster);
            break;
        }
        booster.Eaten();
        booster.PlaySound();
    }
    public static void OnTriggerEnter(Collider2D collider2D)
    {
        var gameObject = collider2D.gameObject;
        var tag        = gameObject.tag;

        if (tag.Equals(EnemyTag))
        {
            if (BoosterController.GodMoveBoosterActive)
            {
                EnemySpawner.ReleaseEnemy(gameObject.GetComponent <Enemy>());
                return;
            }

            GameController.GameStarted = false;
            return;
        }

        if (tag.Equals(BoosterTag))
        {
            BoosterController.ActivateBooster(gameObject.GetComponent <BaseBooster>());
        }
    }
    public void CreateBooster(Player player)
    {
        BoosterType type = GetRandomBooster();

        if (type != BoosterType.None)
        {
            GameObject go    = new GameObject("Booster");
            float      randX = Random.Range(clamp.min.x, clamp.max.x);
            float      randY = Random.Range(clamp.min.y, clamp.max.y);
            go.transform.position = new Vector3(randX, randY, 0);
            SpriteRenderer renderer = go.AddComponent <SpriteRenderer>();
            renderer.sprite       = boosters[GetIndexOfBooster(type)].sprite;
            renderer.sortingOrder = 7;
            BoxCollider2D collider = go.AddComponent <BoxCollider2D>();
            collider.isTrigger = true;
            BoosterController controller = go.AddComponent <BoosterController>();
            //go.layer = layer;
            controller.interacting = player;
            controller.boosterType = type;
            boosterControllers.Add(controller);
            boosterControllers = boosterControllers.Where(item => item != null).ToList();
        }
    }
    private void BoosterTouch(GameObject hit)
    {
        BoosterController booster = hit.transform.parent.GetComponent <BoosterController>();

        booster.changeDirection();
    }
 public void EatBadBooster(BoosterController booster)
 {
     SetMonsterState(MonsterState.EatBad);
     Common.Instance.AddNonPauseAction(BadBooster);
 }
 // Use this for initialization
 void Start()
 {
     booster       = transform.parent.GetComponent <BoosterController>();
     light         = GetComponent <Light>();
     startEmission = light.intensity;
 }
Beispiel #9
0
 private void Awake()
 {
     healthbar   = GameObject.Find("UIManager/Health").GetComponent <Slider>();
     SpeedSlider = GameObject.Find("UIManager/SpeedSlider").GetComponent <Slider>();
     boostercon  = GameObject.Find("UIManager/Booster").GetComponent <BoosterController>();
 }
Beispiel #10
0
 // Use this for initialization
 void Start()
 {
     booster = transform.parent.GetComponent <BoosterController>();
 }