示例#1
0
        //---------------------------------------------------------------------------

        #region Private Member Data

        //---------------------------------------------------------------------------



        //---------------------------------------------------------------------------

        #endregion

        //---------------------------------------------------------------------------

        #region Accessors and Mutators

        //---------------------------------------------------------------------------



        //---------------------------------------------------------------------------

        #endregion

        //---------------------------------------------------------------------------

        #region Public Member Functions

        //---------------------------------------------------------------------------

        public void DestroyBlock(Vector3i?point)
        {
            if (point.HasValue)
            {
                OCMap map = OCMap.Instance;        //(OCMap)GameObject.FindSceneObjectsOfType(typeof(OCMap)).FirstOrDefault();

                OCGoalController[] goalControllers = (OCGoalController[])GameObject.FindObjectsOfType(typeof(OCGoalController));

                OCBlock blockType = map.GetBlock(point.Value).block;

                map.SetBlockAndRecompute(OCBlockData.CreateInstance <OCBlockData>().Init(null, point.Value), point.Value);

                foreach (OCGoalController goalController in goalControllers)
                {
                    if (goalController.GoalBlockType == blockType)
                    {
                        goalController.FindGoalBlockPositionInChunks(map.GetChunks());
                    }
                }
            }
        }