1.0.4 • Published 7 years ago

@umm/physics_accessor v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

What?

  • this.BoxCollider(), this.Rigidbody2D(), ... などで参照できる Physics/Physics2D 関連のアクセサを提供します

Why?

  • 毎回アクセサを書くのがシンドイので

Install

$ npm install github:umm-projects/physics_accessor.git

Usage

using UnityEngine;
using AccessorUtility;

public class Hoge : MonoBehaviour, IRigidbody2DAccessor {

    public void Start() {
        this.Righdbody2D().AddForce(Vector2.up * 100.0f);
    }

}
  1. AccessorUtility.IRigidbodyAccessor などを実装します
  2. 拡張メソッドとして対応するアクセサが提供されます
    • 提供されているインタフェースとアクセサの対応は以下の通りです
interfaceaccessor
IPhysicsAccessor-
IRigidbodyAccessorRigidbody()
IColliderAccessor-
IBoxColliderAccessorBoxCollider()
ICapsuleColliderAccessorCapsuleCollider()
IMeshColliderAccessorMeshCollider()
ISphereColliderAccessorSphereCollider()
ITerrainColliderAccessorTerrainCollider()
IWheelColliderAccessorWheelCollider()
IJointAccessor-
ICharacterJointAccessorCharacterJoint()
IConfigurableJointAccessorConfigurableJoint()
IFixedJointAccessorFixedJoint()
IHingeJointAccessorHingeJoint()
ISpringJointAccessorSpringJoint()
IPhysics2DAccessor-
IRigidbody2DAccessorRigidbody2D()
ICollider2DAccessor-
IBoxCollider2DAccessorBoxCollider2D()
ICircleCollider2DAccessorCircleCollider2D()
IEdgeCollider2DAccessorEdgeCollider2D()
IPolygonCollider2DAccessorPolygonCollider2D()
IJoint2DAccessor-
IDistanceJoint2DAccessorDistanceJoint2D()
IFixedJoint2DAccessorFixedJoint2D()
IFrictionJoint2DAccessorFrictionJoint2D()
IHingeJoint2DAccessorHingeJoint2D()
IRelativeJoint2DAccessorRelativeJoint2D()
ISliderJoint2DAccessorSliderJoint2D()
ISpringJoint2DAccessorSpringJoint2D()
ITargetJoint2DAccessorTargetJoint2D()
IWheelJoint2DAccessorWheelJoint2D()
  • 階層的に上位に居るインタフェースは下位のインタフェースが提供するアクセサを全て含有します
  • AccessorUtility を using することで拡張メソッドが提供されます。

License

Copyright (c) 2017 Tetsuya Mori

Released under the MIT license, see LICENSE.txt