Example #1
0
    public void OnMouseDown()
    {
        if (MGGlobalDataCenter.defaultCenter().isStop == true)
        {
            return;
        }
        int num = int.Parse(dartNum.text);

        if (!isCD && num > 0 && !MGGlobalDataCenter.defaultCenter().isBigSkilling)//如果不是GCD 且个数大于0 就可以放技能
        {
            print("update ********isPressDartButton : " + isPressDartButton);
            isPressDartButton = true;
            dartAnim.SetBool("pressDartButton", isPressDartButton);
            print("update ********isPressDartButton : " + isPressDartButton);
            if (num == MGSkillDartInfo.skillHoldLevel)//只有个数等于最大数量时才重置fillAmount
            {
                cdBack.fillAmount = addOrDec ? 0f : 1f;
            }
            --num;
            dartNum.text = num.ToString();
            isCD         = true;
            cdBackObject.transform.localScale = new Vector3((addOrDec ? 1 : -1) * (direction ? -1 : 1), 1, 1);
            MGNotificationCenter.defaultCenter().postNotification(SkillActEventEnum.dart, null);
        }
    }
Example #2
0
 void Start()
 {
     isReceiveIP    = false;
     isCancelListen = false;
     udpReceive     = new listenForServerDelegate(UDPStartToReceive);
     MGGlobalDataCenter.defaultCenter().serverIp = MGFoundtion.getInternIP();
 }
Example #3
0
    //线程函数
    public string UDPStartToReceive(int port)
    {
        Socket     socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);     //初始化一个Scoket协议
        IPEndPoint iep    = new IPEndPoint(IPAddress.Any, MGGlobalDataCenter.defaultCenter().mySocketPort); //初始化一个侦听局域网内部所有IP和指定端口
        EndPoint   ep     = (EndPoint)iep;

        socket.Bind(iep);               //绑定这个实例
        byte[] buffer = new byte[1024]; //设置缓冲数据流
        string ip     = null;

        while (true)
        {
            socket.ReceiveFrom(buffer, ref ep);            //接收数据,并确把数据设置到缓冲流里面
            if (isCancelListen)
            {
                break;
            }
            ip = Encoding.Unicode.GetString(buffer);
            IPAddress myAddress = null;
            if (IPAddress.TryParse(ip, out myAddress))
            {
                break;
            }
        }
        socket.Close();
        return(ip);
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        MGGlobalDataCenter.defaultCenter().isBigSkilling = true;
        releaseRole = GameObject.Find("role1");
        releaseRole.GetComponent <Jump> ().stateMask |= roleState.sprint;
        UILabel label = GameObject.Find("log").GetComponent <UIInput>().label;

        label.text    += "\r\nsprint start";
        timer          = 0f;
        isEndedFreeze  = false;
        Time.timeScale = 0.05f;
        duration      *= Time.timeScale;
        wordMask       = 0;
        int length = wordDelayTimeArrayList.Length;

        for (int i = length - 1; i >= 0; --i)
        {
            wordDelayTimeArrayList[i] *= Time.timeScale;
        }

        this.releaseSkillObjectName = "role1";
        transform.parent            = releaseRole.transform;
        base.scaleAnimationFofBigSkill();
        MGGlobalDataCenter.defaultCenter().isSprint = true;
    }
Example #5
0
 void startThreadForSync()
 {
     syncSock    = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);     //初始化一个Scoket实习,采用UDP传输
     label.text += "\r\n self " + MGFoundtion.getInternIP() + ";serverip " + MGGlobalDataCenter.defaultCenter().serverIp + ";clientIP" + MGGlobalDataCenter.defaultCenter().clientIP;
     if (MGGlobalDataCenter.defaultCenter().isFrontRoler)
     {
         //label.text += "\r\n self " + MGFoundtion.getInternIP() + ";serverip " + MGGlobalDataCenter.defaultCenter().serverIp;
         IPAddress clientAddress = IPAddress.Broadcast;
         syncIEP = new IPEndPoint(clientAddress, MGGlobalDataCenter.defaultCenter().SyncPort);            //初始化一个发送广播和指定端口的网络端口实例
         syncEP  = (EndPoint)syncIEP;
         //syncSock.Bind(syncEP);//绑定这个实例
         syncSock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);            //设置该scoket实例的发送形式
         InvokeRepeating("syncNetwork", 0.1f, 0.010f);
     }
     else
     {
         //label.text += "\r\n self " + MGFoundtion.getInternIP() + ";serverip " + MGGlobalDataCenter.defaultCenter().serverIp;
         //Debug.Log("serverIp="+MGGlobalDataCenter.defaultCenter().serverIp);
         IPAddress serverAddress = IPAddress.Any;
         syncIEP = new IPEndPoint(serverAddress, MGGlobalDataCenter.defaultCenter().SyncPort); //初始化一个侦听局域网内部所有IP和指定端口
         syncEP  = (EndPoint)syncIEP;
         syncSock.Bind(syncEP);                                                                //绑定这个实例
         syncThread = new Thread(syncToReceive);
         syncThread.IsBackground = true;
         syncThread.Start();
     }
 }
Example #6
0
 // Update is called once per frame
 void Update()
 {
     if (isMoveCamera)
     {
         Vector3 pos = Camera.main.transform.position;
         pos.y -= cameraMoveSpeed * Time.deltaTime * fx;
         Camera.main.transform.position = pos;
         if ((pos.y <= -1 && fx == 1) || (pos.y >= 0 && fx == -1))
         {
             pos.y = fx > 0 ? -1 : 0;
             Camera.main.transform.position = pos;
             isMoveCamera = false;
         }
     }
     if (isClick)
     {
         if (timer <= 0.10f)
         {
             transform.localScale = new Vector3((transform.localScale.x - 0.03f * Time.timeScale), (transform.localScale.y - 0.03f * Time.timeScale), (transform.localScale.z - 0.03f * Time.timeScale));
             timer += Time.deltaTime;
         }
         else if (timer <= 0.2f)
         {
             transform.localScale = new Vector3((transform.localScale.x + 0.03f * Time.timeScale), (transform.localScale.y + 0.03f * Time.timeScale), (transform.localScale.z + 0.03f * Time.timeScale));
             timer += Time.deltaTime;
         }
         else if (timer > 0.2f)
         {
             isClick = false; timer = 0.0f;
             transform.localScale = new Vector3(MGGlobalDataCenter.defaultCenter().UIScale, MGGlobalDataCenter.defaultCenter().UIScale, 1);
         }
     }
 }
Example #7
0
    void OnTriggerEnter2D(Collider2D other)
    {
        string strtmp  = "dart(Clone)";
        int    istrlen = strtmp.Length;

        if (other.tag == "frontSkill" && other.name != "beatback(Clone)")
        {
            print("技能名:金钟罩。打在上面的是" + other.name + ",释放技能的是" + releaseSkillObjcName + ";gameobjc:" + other.gameObject);
            if (other.name.Substring(0, istrlen) == strtmp)
            {
                flyDuang(other, releaseObject);
            }
        }
        if (other.name.Length >= istrlen && other.name.Substring(0, istrlen) == strtmp)
        {
            print("true");
            MGGlobalDataCenter.defaultCenter().isDartDefence = true;
        }
        strtmp  = "roadblock(Clone)";
        istrlen = strtmp.Length;
        if (other.name.Length >= istrlen && other.name.Substring(0, istrlen) == strtmp)
        {
            print("true");
            MGGlobalDataCenter.defaultCenter().isRoadBlockDefence = true;
        }
    }
Example #8
0
 public void OnChoosePlayer_mingyue(GameObject button)
 {
     print("2 click start mingyue");
     if (istianyaLoad == false)
     {
         ismingyueLoad = true;
     }
     if (ismingyueLoad)
     {
         if (MGGlobalDataCenter.defaultCenter().isSingle == true)
         {
             MGGlobalDataCenter.defaultCenter().isLaterRoler = false;
             MGGlobalDataCenter.defaultCenter().isFrontRoler = true;
             if (!MGGlobalDataCenter.defaultCenter().isMingYueGuide)
             {
                 MGFoundtion.setMingYueGuideFlag();
                 MGGlobalDataCenter.defaultCenter().isMingYueGuide = true;
                 Application.LoadLevel("guideScene");
             }
             else
             {
                 Application.LoadLevel("gameScene1");
             }
         }
         else
         {
             this.GetComponent <MyNetworkTest>().createHost();
         }
     }
 }
Example #9
0
    public void gameTimer()
    {
        MGGlobalDataCenter.defaultCenter().totalGameTime -= 0.01f;
        int frontNum = (int)Math.Floor(MGGlobalDataCenter.defaultCenter().totalGameTime);
        int laterNum = (int)((MGGlobalDataCenter.defaultCenter().totalGameTime - frontNum) * 100);

        if (MGGlobalDataCenter.defaultCenter().totalGameTime <= 0f)
        {
            CancelInvoke("gameTimer");
            //游戏结束
            if (GameObject.Find("role").GetComponent <RoleAnimController>().isDead || GameObject.Find("role1").GetComponent <RoleAnimController>().isDead)
            {
                return;
            }
            MGGlobalDataCenter.defaultCenter().overSenceUIName = "victoryFrontGameUI";
            Application.LoadLevel("overSence");
            MGMsgModel gameoverModel = new MGMsgModel();
            gameoverModel.eventId        = RoleActEventEnum.gameoverEventId;
            gameoverModel.gameobjectName = MGGlobalDataCenter.defaultCenter().overSenceUIName;
            mgNetWorking.sendMessageToPeer(JsonMapper.ToJson(gameoverModel));
            return;
        }
        if (laterNum < 10)
        {
            gameTimerLabel.GetComponent <UILabel>().text = frontNum + ":0" + laterNum;
        }
        else
        {
            gameTimerLabel.GetComponent <UILabel>().text = frontNum + ":" + laterNum;
        }
    }
 void Update()
 {
     if (!isUseFirstSkill && blinkTimer > 0.5f)
     {
         Debug.Log("*************************************************");
         firstSkill();
     }
     blinkTimer  += Time.deltaTime;
     bonesTimer  += Time.deltaTime;
     sprintTimer += Time.deltaTime;
     if (MGGlobalDataCenter.defaultCenter().isGameOver)
     {
         return;
     }
     if (blinkTimer > 7f)
     {
         blinkTimer = 0f;
         MGNotificationCenter.defaultCenter().postNotification(SkillActEventEnum.blink, null);
     }
     if (bonesTimer > 8f)
     {
         bonesTimer = 0f;
         MGNotificationCenter.defaultCenter().postNotification(SkillActEventEnum.bones, null);
     }
     if (sprintTimer > 9f)
     {
         sprintTimer = 0f;
         MGNotificationCenter.defaultCenter().postNotification(SkillActEventEnum.sprint, null);
     }
 }
Example #11
0
 void startThreadForSyncTCP()
 {
     syncSockTCP = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     label.text += "\r\n self " + MGFoundtion.getInternIP() + ";serverip " + MGGlobalDataCenter.defaultCenter().serverIp + ";clientIP" + MGGlobalDataCenter.defaultCenter().clientIP;
     if (MGGlobalDataCenter.defaultCenter().isFrontRoler)
     {
         syncIEP = new IPEndPoint(IPAddress.Parse(MGGlobalDataCenter.defaultCenter().clientIP), MGGlobalDataCenter.defaultCenter().SyncPort);            //服务器的IP和端口
         try
         {
             //因为客户端只是用来向特定的服务器发送信息,所以不需要绑定本机的IP和端口。不需要监听。
             syncSockTCP.Connect(syncIEP);
         }
         catch (SocketException e)
         {
             label.text += " unable to connect to server" + e.ToString();
         }
         InvokeRepeating("syncNetworkTCP", 0.1f, 0.010f);
     }
     else
     {
         syncIEP = new IPEndPoint(IPAddress.Any, MGGlobalDataCenter.defaultCenter().SyncPort);            //本机预使用的IP和端口
         syncSockTCP.Bind(syncIEP);
         syncThread = new Thread(syncToReceiveTCP);
         syncThread.IsBackground = true;
         syncThread.Start();
     }
 }
Example #12
0
    public void createCommonUI()
    {
        print("createCommonUI");
        createOneUI(downButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenLiftX + 1.5f * MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth, -4f, 0f));
        createOneUI(upButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenRightX - 1f * MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth, -4f, 0f));
        float padding = 0f;

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            padding = 0.8f;
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            padding = 0f;
            try
            {
                GameObject.Find("log").GetComponent <UILabel>().text += "\r\n" + MGGlobalDataCenter.defaultCenter().screenLiftX + ";" + MGGlobalDataCenter.defaultCenter().screenTopY;
                GameObject.Find("log").GetComponent <UILabel>().text += "\r\n" + MGGlobalDataCenter.defaultCenter().pixelWidth + ";" + MGGlobalDataCenter.defaultCenter().pixelHight;
                GameObject.Find("log").GetComponent <UILabel>().text += "\r\n" + Camera.current.orthographicSize.ToString();
                GameObject.Find("log").GetComponent <UILabel>().text += "\r\n" + uiCamera.orthographicSize.ToString();
            }
            catch { }
        }
        GameObject objc = createOneUI(stopButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenRightX - MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth / 2 + padding, MGGlobalDataCenter.defaultCenter().screenTopY - MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth / 2 + padding, 0f));

        UIEventListener.Get(objc).onClick = clickStop;
        gameTimerLabel = createOneUI(gameTimerLabel, new Vector3(1.2f, MGGlobalDataCenter.defaultCenter().screenTopY, 0));
        gameTimerLabel.GetComponent <UILabel>().text = "60:00";
    }
Example #13
0
    void syncNetworkTCP()
    {
        if (MGGlobalDataCenter.defaultCenter().isFrontRoler&& MGGlobalDataCenter.defaultCenter().roleLater != null)
        {
            //Debug.Log("syncNetwork;"+MGGlobalDataCenter.defaultCenter().clientIP);
            //label.text = MGGlobalDataCenter.defaultCenter().clientIP + ";" + MGGlobalDataCenter.defaultCenter().serverIp;
            Vector3 roleLaterPos = MGGlobalDataCenter.defaultCenter().roleLater.transform.position;
            byte[]  buffer       = Encoding.ASCII.GetBytes(roleLaterPos.x.ToString());
            try
            {
                syncSockTCP.Send(buffer);
            }
            catch (SocketException e)
            {
                label.text = " send execption" + e.ToString();
//				try
//				{
//					//因为客户端只是用来向特定的服务器发送信息,所以不需要绑定本机的IP和端口。不需要监听。
//					syncSockTCP.Connect(syncIEP);
//				}
//				catch
//				{
//					label.text = "syncNetworkTCP unable to connect to server" + e.ToString();
//				}
            }
        }
    }
Example #14
0
    // Use this for initialization
    void Start()
    {
        x_k = MGGlobalDataCenter.defaultCenter().pixelWidth / width;
        y_k = MGGlobalDataCenter.defaultCenter().pixelHight / height;

        overObj1 = GameObject.Find("victoryFrontGameUI");
        overObj2 = GameObject.Find("failLaterGameUI");
        overObj3 = GameObject.Find("victoryLaterGameUI");
        overObj4 = GameObject.Find("failFrontGameUI");
        if (overObj1)
        {
            overObj1.transform.localScale = new Vector3(x_k, y_k, 1);
        }
        if (overObj2)
        {
            overObj2.transform.localScale = new Vector3(x_k, y_k, 1);
        }
        if (overObj3)
        {
            overObj3.transform.localScale = new Vector3(x_k, y_k, 1);
        }
        if (overObj4)
        {
            overObj4.transform.localScale = new Vector3(x_k, y_k, 1);
        }
    }
Example #15
0
 // Update is called once per frame
 void Update()
 {
     playSkillAnimation();
     if (transform.position.x < MGGlobalDataCenter.defaultCenter().screenLiftX)
     {
         DestroySelf();
     }
 }
    // Use this for initialization
    public void createAllDarkLayerInPos()
    {
        dark_midClone = GameObject.Instantiate(dark_other, Vector3.zero, Quaternion.Euler(0, 0, 0)) as GameObject;
        dark_midClone.GetComponent <MGGuideDarkMidListenr>().isEnable = true;
        Vector3 dark_midCloneSize = dark_midClone.GetComponent <SpriteRenderer>().bounds.size, dark_midCloneScale = dark_midClone.transform.localScale;

        dark_midClone.transform.localScale = new Vector3(dark_midCloneScale.x * (MGGlobalDataCenter.defaultCenter().screenRightX - MGGlobalDataCenter.defaultCenter().screenLiftX / dark_midCloneSize.x),
                                                         dark_midCloneScale.y * ((MGGlobalDataCenter.defaultCenter().screenTopY - MGGlobalDataCenter.defaultCenter().screenBottomY) / dark_midCloneSize.y), 1);
    }
Example #17
0
    // Use this for initialization
    void Start()
    {
        x_k = MGGlobalDataCenter.defaultCenter().pixelWidth / width;
        y_k = MGGlobalDataCenter.defaultCenter().pixelHight / height;

        startObj = GameObject.Find("start");
        startObj.transform.localScale = new Vector3(x_k * startObj.transform.localScale.x, y_k * startObj.transform.localScale.y, 1);
        Debug.Log(startObj.transform.localScale);
    }
Example #18
0
 void Start()
 {
     releaseSkillObjectName = "role";
     isBreak          = false;
     mgNetWorking     = GameObject.Find("NetWork").GetComponent <MGNetWorking>();
     gameObject.name += MGGlobalDataCenter.defaultCenter().dartIndex.ToString();
     MGGlobalDataCenter.defaultCenter().dartIndex = (MGGlobalDataCenter.defaultCenter().dartIndex + 1) % (MGSkillDartInfo.skillHoldLevel * MGSkillRoadblockInfo.skillHoldLevel);
     MGNotificationCenter.defaultCenter().addObserver(this, triggerFunc, SkillEnum.roadblock + gameObject.name);
 }
Example #19
0
 // Update is called once per frame
 void Update()
 {
     movespeed = speed * Time.deltaTime;
     transform.Translate(Vector3.left * movespeed, Space.World);         //向左移动
     if (transform.localPosition.x < MGGlobalDataCenter.defaultCenter().screenLiftX - transform.GetComponent <SpriteRenderer>().bounds.size.x / 2)
     {
         transform.localPosition = new Vector3(orginPositionX, transform.localPosition.y, transform.localPosition.z);
     }
 }
Example #20
0
 void Start()
 {
     isR           = false;
     isReceiveSync = false;
     receivePosX   = 0f;
     serverIp      = MGGlobalDataCenter.defaultCenter().serverIp;
     label         = GameObject.Find("log").GetComponent <UIInput>().label;
     initGameData();
 }
Example #21
0
    GameObject createOneUI(GameObject gameObject, Vector3 pos)
    {
        GameObject objc = GameObject.Instantiate(gameObject, new Vector3(0, 0, 0), Quaternion.Euler(0, 0, 0)) as GameObject;

        objc.transform.parent     = NGUIRoot.transform;
        objc.layer                = UILayerMask;
        objc.transform.position   = MGFoundtion.WorldPointToNGUIPoint(pos, uiCamera);
        objc.transform.localScale = new Vector3(MGGlobalDataCenter.defaultCenter().UIScale, MGGlobalDataCenter.defaultCenter().UIScale, 1);
        return(objc);
    }
Example #22
0
 public void findHost()
 {
     if (NetworkPeerType.Disconnected == Network.peerType)
     {
         Debug.Log("find host");
         isCancelListen = false;
         isReceiveIP    = false;
         udpReceive.BeginInvoke(MGGlobalDataCenter.defaultCenter().mySocketPort, UDPStartToReceiveCallback, null);
     }
 }
Example #23
0
 public void createFrontRoleUI()
 {
     print("createFrontRoleUI");
     //路障按钮UI
     createOneUI(roadblockButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenRightX - MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth / 2 - 0.25f, 2.29f, 0f));
     //飞镖按钮UI
     createOneUI(dartButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenRightX - 2.5f * MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth, -4f, 0f));
     //击退按钮
     createOneUI(beatbackButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenLiftX + MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth / 2 + 0.25f, 2.29f, 0f));
 }
Example #24
0
 public void createLaterRoleUI()
 {
     print("createLaterRoleUI");
     //金钟罩按钮UI
     createOneUI(bonesButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenRightX - MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth / 2 - 0.25f, 2.29f, 0f));
     //冲刺
     createOneUI(sprintButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenLiftX + MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth / 2 + 0.25f, 2.29f, 0f));
     //闪现按钮UI
     createOneUI(blinkButton, new Vector3(MGGlobalDataCenter.defaultCenter().screenRightX - 2.5f * MGGlobalDataCenter.defaultCenter().NGUI_ButtonWidth, -4f, 0f));
 }
Example #25
0
    void sprintEffect(MGNotification notification)
    {
        if (notification != null)
        {
            sprintSwitch = notification;
            MGMsgModel skillModel = (MGMsgModel)notification.objc;
            GameObject objc       = GameObject.Find(skillModel.gameobjectName);
            if (objc)
            {
                if (tempObjcet == null)
                {
                    tempObjcet = GameObject.Find("sprint(Clone)");
                }
                float dis = MGGlobalDataCenter.defaultCenter().roleFrontPos.x - MGGlobalDataCenter.defaultCenter().roleLaterPos.x;
                objc.transform.Translate(speedSwitch * Vector3.right * MGSkillSprintInfo.SkillEffectSpeed * dis * Time.deltaTime / MGSkillSprintInfo.durationTime);
                if (tempObjcet)
                {
                    int fx = objc.transform.localScale.y > 0?1:-1;
                    tempObjcet.transform.position = new Vector3(objc.transform.position.x + 0.25f, objc.transform.position.y + fx * objc.GetComponent <SpriteRenderer>().bounds.size.y / 2f, objc.transform.position.z);
                }
            }
            sprintTimer += Time.deltaTime;
            if (sprintTimer > MGSkillSprintInfo.durationTime)
            {
                //修改背景的移动速度
                GameObject[] backgroundList = GameObject.FindGameObjectsWithTag("Background");
                for (int i = 0; i < backgroundList.Length; ++i)
                {
                    backgroundList[i].GetComponent <bgnear>().speed -= 20;
                }
                backgroundList = GameObject.FindGameObjectsWithTag("Road");
                for (int i = 0; i < backgroundList.Length; ++i)
                {
                    backgroundList[i].GetComponent <bgnear>().speed -= 20;
                }

                objc.GetComponent <RoleAnimController>().isSprint = false;
                objc.GetComponent <Animator>().SetBool("sprint", false);
                objc.GetComponent <SpriteRenderer>().material = new Material(Shader.Find("Sprites/Default"));
                UILabel label = GameObject.Find("log").GetComponent <UIInput>().label;
                Vector3 pos1  = GameObject.Find("role1").transform.position;
                Vector3 pos   = GameObject.Find("role").transform.position;
                label.text  += "\r\nrole.x=" + pos.x + ";role1.x=" + pos1.x;
                sprintTimer  = 0;
                sprintSwitch = null;
                tempObjcet   = null;
                GameObject sprint = GameObject.Find("sprint(Clone)");
                if (sprint != null)
                {
                    Destroy(sprint);
                }
                objc.GetComponent <Jump>().stateMask &= ~roleState.sprint;
            }
        }
    }
 void controlleOtherToDown()
 {
     if (MGGlobalDataCenter.defaultCenter().isLaterRoler)
     {
         MGNotificationCenter.defaultCenter().postNotification(RoleActEventEnum.downToLineFormerEventId, null);
     }
     else if (MGGlobalDataCenter.defaultCenter().isFrontRoler)
     {
         MGNotificationCenter.defaultCenter().postNotification(RoleActEventEnum.dowmToLineLatterEventId, null);
     }
 }
Example #27
0
    public void changeRollBackState()
    {
        //Debug.Log("翻滚结束切换回正常动画");
        rollTimer = 0f;
        float flag = downOrUp?1:-1;

        transform.localScale = new Vector3(1, -1 * flag, 1);
        transform.position   = new Vector3(transform.position.x, MGGlobalDataCenter.defaultCenter().roadOrignY, transform.position.z);
        toNomalRun();
        animStateToRun();
    }
Example #28
0
 public void syncNetworkUDP()    //主机向客户端发送UDP包让客户端同步主机的数据
 {
     if (MGGlobalDataCenter.defaultCenter().isFrontRoler&& MGGlobalDataCenter.defaultCenter().roleLater != null)
     {
         //Debug.Log("syncNetwork;"+MGGlobalDataCenter.defaultCenter().clientIP);
         //label.text = MGGlobalDataCenter.defaultCenter().clientIP + ";" + MGGlobalDataCenter.defaultCenter().serverIp;
         Vector3 roleLaterPos = MGGlobalDataCenter.defaultCenter().roleLater.transform.position;
         byte[]  buffer       = Encoding.ASCII.GetBytes(roleLaterPos.x.ToString());
         syncSock.SendTo(buffer, syncEP);
     }
 }
Example #29
0
    // Update is called once per frame
    void Update()
    {
        y += 0.05f;
        this.transform.Translate(new Vector3(Random.Range(1f, 3f), Mathf.Sin(y) / 5f, 0) * Random.Range(3f, 5f) * Time.deltaTime);
        //this.transform.Translate(new Vector3(Random.Range(1f, 2f), Random.Range(0.1f, 0.2f) * Time.deltaTime));

        if (this.transform.position.x > MGFoundtion.pixelToWroldPoint(MGGlobalDataCenter.defaultCenter().pixelWidth, 0).x)
        {
            Destroy(this.gameObject);
        }
    }
 // Use this for initialization
 void Start()
 {
     if (this.gameObject.name == "role")
     {
         MGGlobalDataCenter.defaultCenter().roleFrontPos = transform.position;
     }
     else if (this.gameObject.name == "role1")
     {
         MGGlobalDataCenter.defaultCenter().roleLaterPos = transform.position;
     }
 }