public virtual void Awake() { #region References cacheTransform = GetComponent <Transform>(); cInput = GetComponent <CharInput>(); rBody = GetComponent <Rigidbody2D>(); cacheGM = GameManager.instance; #endregion #region ECB Setup GameObject gg = Instantiate(cInfo.costumes[selectedCostume], visualRoot.transform, false); if (!string.IsNullOrEmpty(ecbBottomBone)) { bottomBone = gg.transform.FindDeepChild(ecbBottomBone).gameObject; } if (!string.IsNullOrEmpty(ecbTopBone)) { topBone = gg.transform.FindDeepChild(ecbTopBone).gameObject; } #endregion #region States //States CharIdleState cis = new CharIdleState(); cis.Setup(cInput, this); stateDictionary.Add(cis.StateName, cis); CharWalkState cws = new CharWalkState(); cws.Setup(cInput, this); stateDictionary.Add(cws.StateName, cws); currentState = stateDictionary[cis.StateName]; currentState.OnStart(); cState = cis.StateName; #endregion vars.facingRight = true; }
public void Setup(CharInput cInput, CharController cCon) { this.cInput = cInput; cController = cCon; }