// Use this for initialization void Start() { GameObject playerCharacter = GameObject.FindWithTag("PlayerCharacter") as GameObject; if (null != playerCharacter) { Anim = playerCharacter.GetComponent <Animator>(); } if (null != playerCharacter) { MovementTransitionManagerScript = playerCharacter.GetComponent <MovementTransitionManager>(); } GameObject movementPad = GameObject.FindWithTag("MovementPad") as GameObject; if (null != movementPad) { MovementPadScript = movementPad.GetComponent <MovementPad>(); } if (null != movementPad) { KeyboardScript = movementPad.GetComponent <Keyboard>(); } speedBar = GameObject.FindWithTag("SpeedBar") as GameObject; GameObject speedBarKnob = GameObject.FindWithTag("SpeedBarKnob") as GameObject; if (null != speedBarKnob) { SpeedBarScript = speedBarKnob.GetComponent <SpeedBar>(); } if (null == Anim) { Debug.LogError("SimpleMovementModule.Start: Anim is null."); } if (null == MovementTransitionManagerScript) { Debug.LogError("SimpleMovementModule.Start: MovementTransitionManagerScript is null."); } if (null == MovementPadScript) { Debug.LogError("SimpleMovementModule.Start: MovementPadScript is null."); } if (null == KeyboardScript) { Debug.LogError("SimpleMovementModule.Start: KeyboardScript is null."); } if (null == speedBar) { Debug.LogError("SimpleMovementModule.Start: speedBar is null."); } if (null == SpeedBarScript) { Debug.LogError("SimpleMovementModule.Start: SpeedBarScript is null."); } if (null == Anim) { return; } if (null == MovementTransitionManagerScript) { return; } if (null == MovementPadScript) { return; } if (null == KeyboardScript) { return; } if (null == speedBar) { return; } if (null == SpeedBarScript) { return; } CurrentMove = new Move(DirectionType.None, (float)MovementType.Standing); CurrentVector = Direction.ConvertDirectionToVector(DirectionType.None, Vector3.zero); PreviousMove = new Move(DirectionType.None, (float)MovementType.Standing); PreviousVector = Direction.ConvertDirectionToVector(DirectionType.None, Vector3.zero); moduleActive = false; MovementTransitionManagerScript.Register(this); }
// Use this for initialization void Start() { GameObject movementPad = GameObject.FindWithTag("MovementPad") as GameObject; if (null != movementPad) { MovementPadCanvasGroupScript = movementPad.GetComponent <CanvasGroup>(); } if (null != movementPad) { KeyboardScript = movementPad.GetComponent <Keyboard>(); } if (null != movementPad) { movementPadImage = movementPad.GetComponent <Image>(); } GameObject speedBarKnob = GameObject.FindWithTag("SpeedBarKnob") as GameObject; if (null != speedBarKnob) { SpeedBarScript = speedBarKnob.GetComponent <SpeedBar>(); } GameObject speedBarPanel = GameObject.FindWithTag("SpeedBarPanel") as GameObject; if (null != speedBarPanel) { SpeedBarCanvasGroupScript = speedBarPanel.GetComponent <CanvasGroup>(); } if (null == MovementPadCanvasGroupScript) { Debug.LogError("MovementPad.Start: MovementPadCanvasGroupScript is null."); } if (null == KeyboardScript) { Debug.LogError("MovementPad.Start: KeyboardScript is null."); } if (null == SpeedBarScript) { Debug.LogError("MovementPad.Start: SpeedBarScript is null."); } if (null == SpeedBarCanvasGroupScript) { Debug.LogError("MovementPad.Start: SpeedBarCanvasGroupScript is null."); } if (null == MovementPadCanvasGroupScript) { return; } if (null == KeyboardScript) { return; } if (null == SpeedBarScript) { return; } if (null == SpeedBarCanvasGroupScript) { return; } CurrentDirection = DirectionType.None; float padLeft = 500.0f; float padBottom = 60.0f; float padWidth = 255.0f; float padHeight = 255.0f; padRect = new Rect(padLeft, padBottom, padWidth, padHeight); float centerLeft = padLeft + 75.0f; float centerBottom = padBottom + 84.0f; float centerWidth = 108.0f; float centerHeight = 90.0f; centerRect = new Rect(centerLeft, centerBottom, centerWidth, centerHeight); float northLeft = padLeft + 95.0f; float northBottom = padBottom + 185.0f; float northWidth = 64.0f; float northHeight = 55.0f; northRect = new Rect(northLeft, northBottom, northWidth, northHeight); float southLeft = northLeft; float southBottom = padBottom + 10.0f; float southWidth = northWidth; float southHeight = northHeight; southRect = new Rect(southLeft, southBottom, southWidth, southHeight); float eastLeft = padLeft + 180.0f; float eastBottom = padBottom + 101.0f; float eastWidth = 58.0f; float eastHeight = 55.0f; eastRect = new Rect(eastLeft, eastBottom, eastWidth, eastHeight); float westLeft = padLeft + 20.0f; float westBottom = eastBottom; float westWidth = eastWidth; float westHeight = eastHeight; westRect = new Rect(westLeft, westBottom, westWidth, westHeight); }