private static string TranslateInspectState(InspectState inspectState) { switch (inspectState) { case InspectState.Ready: return("待命"); case InspectState.Grabbing: return("采集中"); case InspectState.Grabbed: return("采集完成"); case InspectState.Calibrating: return("校准中"); case InspectState.Calibrated: return("校准完成"); case InspectState.Inspecting: return("检测中"); case InspectState.InspectedWithAccepted: return("检测完成: 良品"); case InspectState.InspectedWithRejected: return("检测完成: 废品"); default: return(string.Empty); } }
// Use this for initialization void Start() { idleState = new IdleState(this); inspectState = new InspectState(this); attackState = new AttackState(this); deadState = new DeadState(this); currentState = idleState; blood = Resources.Load <GameObject>("Blood"); spriteRenderer = GetComponent <SpriteRenderer>(); rigidbody2D = GetComponent <Rigidbody2D>(); player = GameObject.FindGameObjectWithTag("Player"); }