Exemple #1
0
        void GetAndCheckElements()
        {
            GameObject endPointObject = Getter.SingleInstanceObjectWithTag(caller: this,
                                                                           tag: ObjectsTags.EndPoint.ToString(),
                                                                           errorOnNotFound: Errors.EndpointNotFound,
                                                                           multiplesInstance: Errors.MultipleEndpointsFound);

            endPoint = (EndPoint)Getter.Component(this, endPointObject, typeof(EndPoint));

            Checker.SingleExistence(tag: ObjectsTags.StartPoint.ToString(),
                                    errorIfNone: Errors.StartPointNotFound,
                                    errorIfMultiple: Errors.MultipleStartPointsFound);

            Checker.CruzedHorizontalPosition(leftGameObject: GameObject.FindGameObjectWithTag(ObjectsTags.StartPoint.ToString()),
                                             rightGameObject: endPointObject,
                                             error: Errors.StartAndEndpointCruzed);

            Checker.SingleOrNoneExistence(tag: ElementiesTags.Destructor.ToString(),
                                          errorIfMultiple: Errors.MultipleDestructorsFound);

            Checker.SingleExistence(tag: UIElementiesTags.Time.ToString(),
                                    errorIfNone: Errors.TimeNotFound,
                                    errorIfMultiple: Errors.MultipleTimesFound);

            Checker.SingleExistence(tag: ElementiesTags.Camera.ToString(),
                                    errorIfNone: Errors.CameraNotFound,
                                    errorIfMultiple: Errors.MultipleCamerasFound);

            if (timeScreen == null)
            {
                throw new UnityException(Errors.TimeNotSetInGameBehavior);
            }
        }
Exemple #2
0
        void GetPlayer()
        {
            GameObject playerObject = Getter.SingleInstanceObjectWithTag(caller: this,
                                                                         tag: PersonsTags.Player.ToString(),
                                                                         errorOnNotFound: Errors.PlayerNotFound,
                                                                         multiplesInstance: Errors.MultiplePlayersFound);

            player = (PlayerBase)Getter.Component(this, playerObject, typeof(PlayerBase));
        }
 void KillAnimation()
 {
     AudioManager.Instance.PlaySoundOnce(caller: this, sound: deathAudioSource);
     animator.speed = 0;
     rb.velocity    = Vector2.zero;
     (Getter.Component(this, gameObject, typeof(Collider2D)) as Collider2D).isTrigger = true;
     (Getter.ComponentInChild(this, gameObject, typeof(CircleCollider2D), 0) as CircleCollider2D).isTrigger = true;
     spriteRenderer.sortingOrder = (int)Layers.OrdersInDefaultLayer.Max;
     rb.AddForce(new Vector2(0, 100));
     rb.gravityScale = Transforms.Gravity.Hard;
 }
        protected virtual void Awake()
        {
            Collider2D coll = (Collider2D)Getter.Component(this, gameObject, typeof(Collider2D));

            if (!coll.isTrigger)
            {
                throw new UnityException(Errors.TriggerNotFoundInATriggerHelper +
                                         CombineCharacters.SpaceColonSpace +
                                         ErrorsAuxs.Caller +
                                         this.ToString() +
                                         CombineCharacters.CommaSpace +
                                         ErrorsAuxs.GameObject +
                                         this.gameObject.ToString());
            }
        }
Exemple #5
0
        IEnumerator KillAnimation(float forceToUp)
        {
            yield return(new WaitForSeconds(Times.Waits.Minimun));

            AudioManager.Instance.PlaySoundOnce(caller: this, sound: deathAudioSource);
            rb.gravityScale = Transforms.Gravity.Hard;
            jump.Execute(rb, forceToUp);
            (Getter.Component(this, gameObject, typeof(Collider2D)) as Collider2D).isTrigger = true;

            rb.transform.localScale = new Vector3(Transforms.Scale.NormalPlus
                                                  , Transforms.Scale.NormalPlus
                                                  , Transforms.Scale.NormalPlus);

            spriteRenderer.sortingOrder = (int)Layers.OrdersInDefaultLayer.Max;
        }
Exemple #6
0
        IEnumerator KillAnimation(float forceToUp)
        {
            yield return(new WaitForSeconds(Times.Waits.Minimun));

            AudioManager.Instance.PlaySoundOnce(caller: this, sound: deathAudioSource);
            rb.gravityScale = Transforms.Gravity.Hard;
            jump.Execute(rb, forceToUp);
            (Getter.Component(this, gameObject, typeof(Collider2D)) as Collider2D).isTrigger = true;

            rb.transform.localScale = new Vector3(Transforms.Scale.NormalPlus
                                                  , Transforms.Scale.NormalPlus
                                                  , Transforms.Scale.NormalPlus);

            spriteRenderer.sortingOrder = (int)Layers.OrdersInDefaultLayer.Max;
            //21.09.19 Raihan untuk kembali ke awal jika player mati
            yield return(new WaitForSeconds(3));

            GameStatus.score = 0;
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
Exemple #7
0
        void Awake()
        {
            PositionUtil positionUtil = new PositionUtil();

            GameObject bottomLimitView = Getter.ObjectWithTag(caller: this, tag: ElementiesTags.BottomLimitView.ToString());
            GameObject rightLimitView  = Getter.ObjectWithTag(caller: this, tag: ElementiesTags.RightLimitView.ToString());
            GameObject leftLimitView   = Getter.ObjectWithTag(caller: this, tag: ElementiesTags.LeftLimitView.ToString());

            BoxCollider2D boxCollider2D = (BoxCollider2D)Getter.Component(this, gameObject, typeof(BoxCollider2D));

            Vector2 vector2 = boxCollider2D.size;

            vector2.x = positionUtil.GetHorizontalDistanceBetweenGameObjects(leftLimitView, rightLimitView) + incrementeInHorizontalSize;
            vector2.y = 1;

            boxCollider2D.size = vector2;

            Vector3 thisPosition = this.transform.position;

            thisPosition.x          = positionUtil.GetHorizontalMiddlePointBetweenGameObjects(leftLimitView, rightLimitView);
            thisPosition.y          = bottomLimitView.transform.position.y - distanceBellowFromBottomLimitView;
            this.transform.position = thisPosition;
        }
Exemple #8
0
 void GetComponents()
 {
     animator    = (Animator)Getter.Component(this, gameObject, typeof(Animator));
     particleSys = (ParticleSystem)Getter.Component(this, gameObject, typeof(ParticleSystem));
 }
 void GetComponents()
 {
     rb             = (Rigidbody2D)Getter.Component(this, gameObject, typeof(Rigidbody2D));
     animator       = (Animator)Getter.Component(this, gameObject, typeof(Animator));
     spriteRenderer = (SpriteRenderer)Getter.ComponentInChild(this, gameObject, typeof(SpriteRenderer), 0);
 }
Exemple #10
0
 void Update()
 {
     ((Text)Getter.Component(this, gameObject, typeof(Text))).text = target.text;
 }