예제 #1
0
 void Start()
 {
     m_PhysicsUpdate.RegisterVelocity("Move", new VelocityAttribute(false, true, false, false, m_MoveAddRate / 4, false, false));
     m_PhysicsUpdate.RegisterVelocity("Jump", new VelocityAttribute(false, true, true, true, 0));
     m_PhysicsUpdate.RegisterVelocity("RetentionJump", new VelocityAttribute(false, true, false, false, 0));
     m_PhysicsUpdate.RegisterVelocity("Rebound", new VelocityAttribute(false, true, true, true, m_ReboundReduceRate));
 }
예제 #2
0
 void Start()
 {
     if (!m_IsDecorate)
     {
         m_PhysicsUpdate.RegisterVelocity("AttractX", new VelocityAttribute(true, false, false, false, 0));
         m_PhysicsUpdate.RegisterVelocity("AttractY", new VelocityAttribute(true, false, false, true, 0));
     }
 }
 public virtual void Init(Vector3 position, Vector2 velocity)
 {
     m_PhysicsUpdate = GetComponent <PhysicsUpdate>();
     m_PhysicsUpdate.RegisterVelocity("Thrown", new VelocityAttribute(false, true, true, false, m_BeThrownReduceRate));
     transform.position = position;
     m_PhysicsUpdate.AddVelocity("Thrown", velocity);
 }
    public void BeFaned(Vector2 force)
    {
        Vector2 velocity = force / m_Rigidbody2D.mass * Time.fixedDeltaTime;

        if (m_PhysicsUpdate.IsContainVelocity("ContinuedAddForceNotGroundClear"))
        {
            m_PhysicsUpdate.AddVelocity("ContinuedAddForceNotGroundClear", velocity);
        }
        else
        {
            m_PhysicsUpdate.RegisterVelocity("ContinuedAddForceNotGroundClear", new VelocityAttribute(false, true, false, false, 0, false));
            Vector2 ground = Vector2.zero;
            if (m_PhysicsUpdate.IsContainVelocity("ContinuedAddForce"))
            {
                ground = m_PhysicsUpdate.GetVelocity("ContinuedAddForce");
                m_PhysicsUpdate.CancelVelocity("ContinuedAddForce");
            }
            m_PhysicsUpdate.AddVelocity("ContinuedAddForceNotGroundClear", ground + velocity);
            Debug.Log(ground);
        }
    }