protected override void OnCreate(GameObject _go, ScriptableObject _scriptable, UNIQUEID _uniqueId) { this.mScriptable = _scriptable as EnemyScriptableObject; this.sr_ = go_.AddComponent <SpriteRenderer>(); this.sr_.sprite = mScriptable.sprite; this.mRiaCollider = new RiaCollider(this.go_, this.trans_, this.mScriptable); }
public bool IsInColliderArea(RiaCollider _target) { float distanceX = _target.trans_.position.x - this.trans_.position.x; float distanceY = _target.trans_.position.y - this.trans_.position.y; float sumRadius = _target.scriptableObject.colliderRadius + this.scriptableObject.colliderRadius; return(distanceX * distanceX + distanceY * distanceY <= sumRadius * sumRadius); }
// _playerID player1 or player2 // _scriptable PlayerScriptableObject // _name GameObjectの名前 // _localPosition localPosition public PlayerActor(PlayerID _playerID, PlayerScriptableObject _scriptable, string _name, Vector3 _localPosition) : base(_name, _localPosition) { this.playerID = _playerID; this.scriptable = _scriptable; this.sr_ = go_.AddComponent <SpriteRenderer>(); this.sr_.sprite = scriptable.sprite; this.mRiaCollider = new RiaCollider(this.go_, this.trans_, this.scriptable); }