// Use this for initialization void Start() { moveController = GetComponent <MapMovement>(); moveController.MoveActionCallback += OnMove; moveController.TileActionCallback += OnTile; animator = GetComponent <Animator>(); animator.speed = 0; }
void Awake() { GameObject player = GameObject.FindGameObjectWithTag("Player"); m_FPS = player.GetComponent <FirstPersonController>(); m_Character = player.GetComponent <CharacterController>(); m_Movement = GetComponent <MapMovement>(); m_Movement.enabled = false; m_Map.SetActive(false); }
void Awake() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); serializedObject.Update(); MapMovement targetScript = target as MapMovement; List <string> excludedProperties = new List <string>(); if (!targetScript.ignoreManager) { excludedProperties.Add("segmentEnabled"); } DrawPropertiesExcluding(serializedObject, excludedProperties.ToArray()); serializedObject.ApplyModifiedProperties(); }
List <MapMovement> GetAllMapMovementScripts() { List <MapMovement> tempArray = new List <MapMovement>(); foreach (GameObject seg in lockedSegments) { MapMovement foundMapMove = seg.GetComponent <MapMovement>(); if (foundMapMove) { tempArray.Add(foundMapMove); l_loadedData++; } else { Debug.LogWarning("There is no MapMovement script in " + seg + ". Could have been misplaced."); } } return(tempArray); }
private void OnDrawGizmosSelected() { if (lockedSegments == null || lockedSegments.Length == 0) { return; } // Display all selected locked segments foreach (GameObject seg in lockedSegments) { MapMovement mapMove = seg.GetComponent <MapMovement>(); if (mapMove.IsSegmentEnabled()) { Gizmos.color = Color.green; } else { Gizmos.color = Color.red; } Gizmos.DrawCube(seg.transform.position, Vector3.one * 0.1f); } }
private void InitMap() { mapMovement = new MapMovement(player.QuestId); }
internal void TryCombat(Party party, MapMovement direct) { var combat = Rock.Instance.GetService<CombatOverwatchService>() as CombatOverwatchService; Party with; WorldEntity ent = party.First(); //TODO: fix, make code safe for map bounds, do a thingy with get x/y co-ords and reuse and shit switch (direct) { case MapMovement.Up: with = _worldLocations["0x0"][ent.MyParty.X, ent.MyParty.Y - 1].Entity; if (with != null) { if (ent is Player) { combat.Start(party, with, true, false); } else { combat.Start(with, party, false, true); } } break; case MapMovement.Down: with = _worldLocations["0x0"][ent.MyParty.X, ent.MyParty.Y + 1].Entity; if (with != null) { if (ent is Player) { combat.Start(party, with, true, false); } else { combat.Start(with, party, false, true); } } break; case MapMovement.Left: with = _worldLocations["0x0"][ent.MyParty.X - 1, ent.MyParty.Y].Entity; if (with != null) { if (ent is Player) { combat.Start(party, with, true, false); } else { combat.Start(with, party, false, true); } } break; case MapMovement.Right: with = _worldLocations["0x0"][ent.MyParty.X + 1, ent.MyParty.Y].Entity; if (with != null) { if (ent is Player) { combat.Start(party, with, true, false); } else { combat.Start(with, party, false, true); } } break; } }
internal bool Move(int x, int y, MapMovement move) { switch (move) { case MapMovement.Up: if (TileOpen(x, y - 1)) { var ent = _worldLocations["0x0"][x, y].Entity; _worldLocations["0x0"][x, y].Entity = null; _worldLocations["0x0"][x, y - 1].Entity = ent; ent.Y = y - 1; ent.X = x; return true; } break; case MapMovement.Down: if (TileOpen(x, y + 1)) { var ent = _worldLocations["0x0"][x, y].Entity; _worldLocations["0x0"][x, y].Entity = null; _worldLocations["0x0"][x, y + 1].Entity = ent; ent.Y = y + 1; ent.X = x; return true; } break; case MapMovement.Left: if (TileOpen(x - 1, y)) { var ent = _worldLocations["0x0"][x, y].Entity; _worldLocations["0x0"][x, y].Entity = null; _worldLocations["0x0"][x - 1, y].Entity = ent; ent.Y = y; ent.X = x - 1; return true; } break; case MapMovement.Right: if (TileOpen(x + 1, y)) { var ent = _worldLocations["0x0"][x, y].Entity; _worldLocations["0x0"][x, y].Entity = null; _worldLocations["0x0"][x + 1, y].Entity = ent; ent.Y = y; ent.X = x + 1; return true; } break; } return false; }
private void OnMapMovement(GameMapMovementMessage message) { MapMovement?.Invoke(message); }