public override void OnInspectorGUI() { DrawDefaultInspector(); if (path != null) { // path.NormalPath = EditorGUILayout.ObjectField("Normal Path", path.NormalPath, typeof(GameObject), true) as GameObject; // path.OneWayPath = EditorGUILayout.ObjectField("One Way Path", path.OneWayPath, typeof(GameObject), true) as GameObject; // path.HighlightedNormalPath = EditorGUILayout.ObjectField("Highlighted Normal Path", path.HighlightedNormalPath, typeof(GameObject), true) as GameObject; // path.pathLength = EditorGUILayout.IntField("Path Length", path.pathLength); // path.Type = (Path.PathType)EditorGUILayout.EnumPopup("Path Type", path.Type); // if (path.Type == Path.PathType.OneWay) // { // path.OneWayDirection = (Path.OneWayMode)EditorGUILayout.EnumPopup("One Way Direction", path.OneWayDirection); // } //What type am I? //Switch Object to that type. if (path.Type == MMPath.PathType.Normal) { path.NormalPath.SetActive(true); path.OneWayPath.SetActive(false); } else { path.NormalPath.SetActive(false); path.OneWayPath.SetActive(true); } } else { path = target as MMPath; } }
/// <summary> /// On init we grab all the components we'll need /// </summary> protected override void Initialization() { _collider = this.gameObject.GetComponent <Collider>(); _controller = this.gameObject.GetComponent <TopDownController>(); _character = this.gameObject.GetComponent <Character>(); _characterMovement = this.gameObject.GetComponent <CharacterMovement>(); _health = this.gameObject.GetComponent <Health>(); _mmPath = this.gameObject.GetComponent <MMPath>(); // initialize the start position _startPosition = transform.position; _initialPosition = this.transform.position; _initialDirection = _direction; _initialScale = transform.localScale; _currentIndex = 0; _indexLastFrame = -1; LastReachedPatrolPoint = this.transform.position; }
/// <summary> /// On init we grab all the components we'll need /// </summary> protected override void Initialization() { // we get the CorgiController2D component _controller = this.gameObject.GetComponent <CorgiController>(); _character = this.gameObject.GetComponent <Character>(); _characterFly = this.gameObject.GetComponent <CharacterFly>(); _health = this.gameObject.GetComponent <Health>(); _mmPath = this.gameObject.GetComponent <MMPath>(); // initialize the start position _startPosition = transform.position; // initialize the direction _direction = _character.IsFacingRight ? Vector2.right : Vector2.left; _initialPosition = this.transform.position; _initialDirection = _direction; _initialScale = transform.localScale; }
/// <summary> /// On init we grab all the components we'll need /// </summary> protected override void Initialization() { _controller = this.gameObject.GetComponentInParent <TopDownController>(); _character = this.gameObject.GetComponentInParent <Character>(); _orientation2D = _character?.FindAbility <CharacterOrientation2D>(); _characterMovement = _character?.FindAbility <CharacterMovement>(); _health = _character?._health; _mmPath = this.gameObject.GetComponentInParent <MMPath>(); // initialize the start position _startPosition = transform.position; // initialize the direction _direction = _orientation2D.IsFacingRight ? Vector2.right : Vector2.left; _initialScale = transform.localScale; _currentIndex = 0; _indexLastFrame = -1; _waitingDelay = 0; _initialized = true; }