53 lines
1.7 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace CreatureControl {
[System.Serializable]
public class Antenna {
private Transform _scape;
public Transform scape {
get => this._scape;
set {
this._scape = value;
this._scapeLength = 0;
}
}
private Transform _funiculus;
public Transform funiculus {
get => this._funiculus;
set {
this._funiculus = value;
this._scapeLength = 0;
this._funiculusLength = 0;
}
}
private Transform _end;
private float _scapeLength = 0;
public float scapeLength {
get {
if (_scapeLength <= 0 && this.scape != null && this._funiculus != null)
_scapeLength = Vector3.Distance(this._scape.position, this._funiculus.position);
return _scapeLength;
}
}
private float _funiculusLength = 0;
public float funuculusLength {
get {
if (_funiculusLength <= 0 && this._funiculus != null && this._end != null)
_funiculusLength = Vector3.Distance(this._funiculus.position, this._end.position);
return _funiculusLength;
}
}
public Side side;
public bool isLeft => side == Side.Left;
public bool isRight => side == Side.Right;
// Movement it seems:
// head-scape joint: mainly 2 degrees of freedom: pitch and yaw. Limited roll is possible
// scape-funiculus joint: mainly 1 degree of freedom: pitch. Limited yaw is possible
}
}