// Use this for initialization
    void Start()
    {
        moveController = GetComponent <MapMovement>();
        moveController.MoveActionCallback += OnMove;
        moveController.TileActionCallback += OnTile;

        animator       = GetComponent <Animator>();
        animator.speed = 0;
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
0
 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();
    }
Ejemplo n.º 5
0
    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);
    }
Ejemplo n.º 6
0
    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);
        }
    }
Ejemplo n.º 7
0
 private void InitMap()
 {
     mapMovement = new MapMovement(player.QuestId);
 }
Ejemplo n.º 8
0
        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;
            }
        }
Ejemplo n.º 9
0
 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;
 }
Ejemplo n.º 10
0
 private void OnMapMovement(GameMapMovementMessage message)
 {
     MapMovement?.Invoke(message);
 }