Example #1
0
        /*
         * void Update()
         * {
         *      red1 = GameObject.FindGameObjectWithTag ("red1");
         *      red2 = GameObject.FindGameObjectWithTag ("red2");
         *      red3 = GameObject.FindGameObjectWithTag ("red3");
         * }*/


        void OnTriggerEnter(Collider other)
        {
            if (isHandled)
            {
                return;
            }

            var splitLineCollider = GetComponent <SplitLinerCollider>();

            Debug.Log($"trigger enter with collider type => {splitLineCollider.colliderType}");

            switch (splitLineCollider.colliderType)
            {
            case SplitLinerColliderType.yellow: {
                gm.DecrementTemp();
                gameObject.SetActive(false);
                aud.Play();
                SplitLinerGameManager.OnYellowBlockHitted();
            }
            break;

            case SplitLinerColliderType.green: {
                gm.DecrementTemp();
                gameObject.SetActive(false);
                aud.Play();
                SplitLinerGameManager.OnGreenBlockHitted();
            }
            break;

            case SplitLinerColliderType.red1:
            case SplitLinerColliderType.red2:
            case SplitLinerColliderType.red3: {
                motor.OnDeath();
            }
            break;

            case SplitLinerColliderType.blue1: {
                motor.needBounce = true;
                tempPos          = transform.position;
                StartCoroutine(SwapOnOtherCollider(0.2f, red1));
            }
            break;

            case SplitLinerColliderType.blue2: {
                motor.needBounce = true;
                tempPos          = transform.position;
                StartCoroutine(SwapOnOtherCollider(0.2f, red2));
            }
            break;

            case SplitLinerColliderType.blue3: {
                motor.needBounce = true;
                tempPos          = transform.position;
                StartCoroutine(SwapOnOtherCollider(0.2f, red3));
            }
            break;
            }

            isHandled = true;
        }
Example #2
0
        public override void Start()
        {
            foreach (var rocket in Rockets)
            {
                rocket.SetActive(false);
            }

            var RocketLevel = Services.SplitService.GetLevel();

            Rockets[RocketLevel - 1].SetActive(true);

            controller = GetComponent <CharacterController> ();
            controller.detectCollisions = false;

            animator = GetComponentInParent <Animator> ();
            rb       = GetComponent <Rigidbody> ();

            //cam = Camera.main.transform;
            gm = FindObjectOfType <SplitLinerGameManager>();
            am = FindObjectOfType <SplitLinerAudioManager>();
            explosionParticles = Instantiate(explosionPrefab).GetComponent <ParticleSystem> ();
            explosionAudio     = explosionParticles.GetComponent <AudioSource> ();
            explosionParticles.gameObject.SetActive(false);
            isLookedAt = false;
        }
Example #3
0
 void Awake()
 {
     motor = FindObjectOfType <PlayerMotor>();
     aud   = FindObjectOfType <SpawnManager>().GetComponent <AudioSource>();
     gm    = FindObjectOfType <SplitLinerGameManager>();
 }