public Info(eId id, eSize size, int life, int wait, float destroy) { this.id = id; this.size = size; this.life = life; this.wait = wait; this.destroy = destroy; }
Info _GetInfo(eId id) { foreach (Info info in InfoTbl) { if (id == info.id) { return(info); } } return(InfoTbl[0]); }
/// <summary> /// Init the specified id, degree, speed and player. /// </summary> /// <param name="id">Identifier.</param> /// <param name="degree">Degree.</param> /// <param name="speed">Speed.</param> /// <param name="player">Player.</param> public void Init(eId id, float degree, float speed, Player player) { this.id = id; _player = player; _rigidbody2D = GetComponent <Rigidbody2D>(); Utils.SetVelocity(_rigidbody2D, degree, speed); Info info = _GetInfo(id); float size = _GetSize(info.size); transform.localScale = new Vector3(size, size, 1); // Set life. life = info.life; // Set wait. wait = info.wait; // Set time for suicide. tDestroy = info.destroy; }