コード例 #1
0
ファイル: TileMove.cs プロジェクト: Voltanos/2DUnityRoguelike
    public GameObject TryMove(Vector3 newPosition)
    {
        //////////////////////////////////////
        //Local Variables

        RaycastHit hit;

        //////////////////////////////////////

        BoxCollider.enabled = false;
        Physics.Linecast(transform.position, newPosition, out hit);
        Debug.DrawLine(transform.position, newPosition, Color.red, 10.0f);
        BoxCollider.enabled = true;

        if ((hit.transform != null) && (TraceDebugMove == true))
        {
            StaticTrace.Log(string.Format("Object name:  {0}", hit.collider.gameObject.name));
            StaticTrace.Log(string.Format("Blocked:  {0}", hit.collider.gameObject.GetComponent <Tile>().Blocked.ToString()));
        }

        if ((hit.transform == null) || (hit.collider.gameObject.GetComponent <Tile>().Blocked == false))
        {
            EnableMove   = true;
            MovePosition = newPosition;
            return(null);
        }

        else
        {
            return(hit.collider.gameObject);
        }
    }
コード例 #2
0
ファイル: NameBox.cs プロジェクト: Voltanos/2DUnityRoguelike
    public void SetNameBox(string name)
    {
        if (DebugMessage == true)
        {
            StaticTrace.Log(string.Format("New NameBox:  {0}", name));
        }

        nameLabel.Content.text = name;

        ShowName = true;
    }
コード例 #3
0
    public static void UpdateModel(MainAggregate updatedAggregate)
    {
        try
        {
            FindAndUpdateModel(updatedAggregate);
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
        }
    }
コード例 #4
0
    public static void UpdatePlayerAttributesInModel(FighterAttributes attributes)
    {
        try
        {
            UpdateFighterAttributes(attributes);
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
        }
    }
コード例 #5
0
    void Update()
    {
        try
        {
            UpdateLabels();
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
        }
    }
コード例 #6
0
    void Start()
    {
        try
        {
            GetMainController();
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
        }
    }
コード例 #7
0
    void OnGUI()
    {
        try
        {
            DrawLabels();
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
        }
    }
コード例 #8
0
    public void Start(EquipmentSlotState slot, FighterAttributes fighter)
    {
        try
        {
            Unequip(slot, fighter);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
コード例 #9
0
    public void Start(FighterAttributes fighter)
    {
        try
        {
            UpdateBonus(fighter);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
コード例 #10
0
    public void Start(AbstractItemAI item, FighterAttributes fighter)
    {
        try
        {
            Equip(item, fighter);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
コード例 #11
0
    public static void Start(int value)
    {
        try
        {
            AddValue(value);
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
コード例 #12
0
    public void PreserveItem()
    {
        try
        {
            TryPreserve();
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
        }
    }
コード例 #13
0
    public static InputSettings GetInputSettingsFromModel()
    {
        try
        {
            return(GetInputSettings());
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
            return(null);
        }
    }
コード例 #14
0
    public static MainAggregate ReturnModel()
    {
        try
        {
            return(FindAndReturnModel());
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
            return(null);
        }
    }
コード例 #15
0
    public static List <AbstractItemAI> GetItemListFromModel()
    {
        try
        {
            return(GetItemList());
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
            return(null);
        }
    }
コード例 #16
0
    public static FighterAttributes GetPlayerAttributesFromModel()
    {
        try
        {
            return(GetFighterAttributes());
        }

        catch (Exception ex)
        {
            StaticTrace.ExceptionLog(ex.Message, ex.StackTrace);
            return(null);
        }
    }
コード例 #17
0
    public static string Start(FighterAttributes attributes)
    {
        try
        {
            return(GetExamineMessage(attributes));
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return("Error in generating message.");
        }
    }
コード例 #18
0
    public static string Start(string name)
    {
        try
        {
            return(RemoveTag(name));
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return(name);
        }
    }
コード例 #19
0
    public static int Start()
    {
        try
        {
            return(GetBonusHP());
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return(0);
        }
    }
コード例 #20
0
    public static int Start(int maxSpawns)
    {
        try
        {
            return(GetSpawns(maxSpawns));
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return(maxSpawns);
        }
    }
コード例 #21
0
    public static FighterAttributes Start()
    {
        try
        {
            return(CreateAttributes());
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return(new FighterAttributes());
        }
    }
コード例 #22
0
    public static Rect Start(Rect rectGUI)
    {
        try
        {
            return(SetRect(rectGUI));
        }

        catch (Exception ex)
        {
            StaticTrace.Log(ex.Message);
            StaticTrace.Log(ex.StackTrace);
            return(rectGUI);
        }
    }
コード例 #23
0
    private void SaveAggregate()
    {
        /////////////////////////////////////////////////////
        //Local Variables

        BinaryFormatter formatter = new BinaryFormatter();

        FileStream file;

        string filePath = "";

        /////////////////////////////////////////////////////

        filePath = GetFilePath();

        file = File.Create(filePath);

        formatter.Serialize(file, this.Aggregate);

        StaticTrace.Log(String.Format("File saved at '{0}'.", filePath));

        file.Close();
    }