示例#1
0
    private void OnTriggerEnter(Collider other)
    {
        DynamicObstacle obstacle = other.GetComponent <DynamicObstacle>();

        if (obstacle != null)
        {
            obstacle.FlipDirection();
        }
    }
        public uint Execute(PacketDistributed ipacket)
        {
            GC_DYNAMICOBSTACLE_OPT packet = (GC_DYNAMICOBSTACLE_OPT )ipacket;

            if (null == packet)
            {
                return((uint)PACKET_EXE.PACKET_EXE_ERROR);
            }
            //enter your logic

            DynamicObstacle.HandleObstacle(packet);
            return((uint)PACKET_EXE.PACKET_EXE_CONTINUE);
        }
示例#3
0
 public void ValidateTile()
 {
     dynamicObstacles.Clear();
     supplyBehaviours.Clear();
     foreach (Transform child in transform)
     {
         DynamicObstacle dynamicObstacle = child.GetComponent <DynamicObstacle>();
         SupplyBehaviour supplyBehaviour = child.GetComponent <SupplyBehaviour>();
         if (dynamicObstacle)
         {
             dynamicObstacles.Add(dynamicObstacle);
         }
         if (supplyBehaviour)
         {
             supplyBehaviours.Add(supplyBehaviour);
         }
     }
 }
    // if a watercooler flies over your head, win some bonus money fo' dat sicc stunt
    bool CheckForOverheadWater()
    {
        Vector3 up           = new Vector3(0, 1, 0);
        Vector3 headPosition = playercontroller.transform.position + up * 1.3f;
        Ray     ray          = new Ray(headPosition, up);

        //Debug.DrawRay(headPosition, up * 10.0f);
        RaycastHit[] hits = Physics.RaycastAll(ray, 10.0f);
        foreach (RaycastHit hit in hits)
        {
            DynamicObstacle obstacle = hit.collider.gameObject.GetComponent <DynamicObstacle>();
            if (obstacle != null && !obstacle.HasDoneMeanStunts())
            {
                obstacle.DoMeanStunts();
                return(true);
            }
        }
        return(false);
    }
示例#5
0
    public void InitBarbedWire(GameObject _point1, GameObject _point2, DynamicObstacle obstacle)
    {
        var openers = new List <Opener>();

        if (!_point1.GetComponent <Opener>())
        {
            openers.Add(_point1.AddComponent <BarbedWire>());
        }
        if (!_point2.GetComponent <Opener>())
        {
            openers.Add(_point2.AddComponent <BarbedWire>());
        }

        _point1.GetComponent <Board_Node>().Type = NodeType.Opener;
        _point2.GetComponent <Board_Node>().Type = NodeType.Opener;

        foreach (var opener in openers)
        {
            opener.SetObstacle(obstacle);
            opener.Initialize();
        }
    }
        /// <summary>
        /// 因为需要从副本里出来后打开副本主界面,所以需要在这个消息响应函数里添加打开界面逻辑
        /// </summary>
        private void OnEnterSceneFinish()
        {
//			Tab_SceneClass lastSceneClass = TableManager.GetSceneClassByID(GameManager.gameManager.LastRunningScene, 0);
//			if (lastSceneClass != null)
//			{
//				if (lastSceneClass.Type == (int)Games.GlobeDefine.GameDefine_Globe.SCENE_TYPE.SCENETYPE_STORYCOPYSCENE &&
//				    !GameManager.gameManager.ActiveScene.IsCopyScene())
//				{
//					UIManager.ShowUI(UIInfo.Activity);
//				}
//			}
            // 如果进入了剧情副本,则创建相应的触发器和动态阻挡
            if (GameManager.gameManager.ActiveScene.IsStoryCopyScene())
            {
                Tab_SceneClass scLine = TableManager.GetSceneClassByID(GameManager.gameManager.RunningScene, 0);
                if (scLine != null)
                {
                    Tab_StoryCopyScene scsLine = TableManager.GetStoryCopySceneByID(scLine.CopySceneID, 0);
                    if (scsLine != null)
                    {
                        // 阻挡
                        string   dynamicObstacleStr = scsLine.ObstaclesID;
                        string[] dynamicObstacles   = dynamicObstacleStr.Split('_');
                        foreach (string s in dynamicObstacles)
                        {
                            int id = -1;
                            if (int.TryParse(s, out id))
                            {
                                Tab_DynamicObstacle doLine = TableManager.GetDynamicObstacleByID(id, 0);
                                if (doLine != null)
                                {
                                    DynamicObstacle.CreateObstacle(id);
                                }
                                else
                                {
                                    LogModule.ErrorLog("Cant find dynamicObstacle {0}", id);
                                }
                            }
                            else
                            {
                                LogModule.ErrorLog("Cant read dynamicObstacle id from {0} in StoryCopyScene {1}", dynamicObstacleStr, scLine.CopySceneID);
                            }
                        }

                        // 改为服务器给客户端发包创建
//						// 触发器
//						Tab_StoryCopySceneFlow scsfLine = TableManager.GetStoryCopySceneFlowByID(scLine.CopySceneID, 0);
//						if (scsfLine != null)
//						{
//							int triggerCnt = scsfLine.getTriggerCount();
//							for (int i = 0; i < triggerCnt; i++)
//							{
//								int triggerId = scsfLine.GetTriggerbyIndex(i);
//								if (triggerId != -1)
//								{
//									if (!CabalTrigger.CreateTrigger(triggerId))
//									{
//										LogModule.ErrorLog("Create trigger failed when enter storyCopyScene {0}", scLine.CopySceneID);
//									}
//								}
//							}
//						}
//						else
//						{
//							LogModule.ErrorLog("Cant find StoryCopySceneFlow {0}", scLine.CopySceneID);
//						}
                    }
                    else
                    {
                        LogModule.ErrorLog("Cant find StoryCopyScene {0}", scLine.CopySceneID);
                    }
                }
            }
        }
 public void Remove(DynamicObstacle obstacle)
 {
     DynamicObstacles.Remove(obstacle);
 }
示例#8
0
    // activate obstacle after delay seconds specified in the Obstacle component
    private IEnumerator DelayedActivateObstable(DynamicObstacle obstacle)
    {
        yield return(new WaitForSeconds(obstacle.GetSpawnDelay()));

        obstacle.gameObject.SetActive(true);
    }
示例#9
0
 // EDITOR FUNCTIONS
 public void SetObstacle(DynamicObstacle _obstacle)
 {
     obstacle = _obstacle;
 }