コード例 #1
0
        internal void Update(GameObject otherGO, Physics2D.Contact c)
        {
            if (this.gameObject == null)
            {
                this.gameObject = otherGO;
                this.collider   = this.gameObject.GetComponent <FPCollider2D>();
                this.rigidbody  = this.gameObject.GetComponent <FPRigidBody2D>();
                this.transform  = this.collider.FPTransform;
            }

            if (c != null)
            {
                if (contacts[0] == null)
                {
                    contacts[0] = new FPContactPoint2D();
                }

                FPVector2 normal;
                Physics2D.FixedArray2 <FPVector2> points;

                c.GetWorldManifold(out normal, out points);

                contacts[0].normal = normal;
                contacts[0].point  = points[0];

                this.relativeVelocity = c.CalculateRelativeVelocity();
            }
        }
コード例 #2
0
        /**
         *  @brief Creates a new {@link FPRigidBody} when there is no one attached to this GameObject.
         **/
        protected override void OnAwake()
        {
            FPTransform = this.GetComponent <FPTransform2D>();
            FPRigidBody = this.GetComponent <FPRigidBody2D>();

            if (lossyScale == FPVector.one)
            {
                lossyScale = FPVector.Abs(transform.localScale.ToFPVector());
            }
        }
コード例 #3
0
        protected override void OnStart()
        {
            if (!Application.isPlaying)
            {
                return;
            }

            Initialize();
            rb = GetComponent <FPRigidBody2D>();
        }
コード例 #4
0
        // Start is called before the first frame update
        protected override void OnStart()
        {
            rb       = GetComponent <FPRigidBody2D>();
            animator = GetComponent <Animator>();
            data.Initialize();
            this.ApplyNewState(data.GetState());
            //animator.SetBool("TransitionState", true);


            stopTimer.onEnd += OnHitstopEnd;

            data.moveCondition.facingRight = false;
            OnNonGrounded();


            //find the gameobject that holds all hitboxes
            foreach (Transform child in this.transform)
            {
                if (child.tag == "Hitboxes")
                {
                    hitboxObj = child.GetComponentsInChildren <Hitbox>();
                }
            }
        }