void Update()
    {
        if (HealthPoint() == 0)
        {
            return;
        }

        if (stunTime_unit == 0 || stunTime == 0 || TimeEx.Cooldown(ref stunTime) == 0)
        {
            if (TimeEx.Cooldown(ref stateTime) == 0)
            {
                StateChange();
            }
            StateUpdate();
        }
        animator.SetBool("isHit", stunTime != 0);

        //시선처리용 코드
        //릴리즈때 지워야댐
        //raycast test
        RaycastHit2D rcHit = Physics2D.Raycast(transform.position, direction, 10000.0f, 1 << LayerMask.NameToLayer("Map"));

        if (rcHit.collider != null)
        {
            Vector2 dirst   = direction * rcHit.distance;
            Vector3 collPos = transform.position + new Vector3(dirst.x, dirst.y, 0);
            Vector3 linePos = new Vector3(transform.position.x, transform.position.y, 0);

            Debug.DrawLine(linePos, collPos, Color.red);
        }
    }
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this._firstAdd)
                {
                    MemoryCacheEx.Add(1, TimeEx.GetTimestamp());
                    this._firstAdd = false;
                }

                MemoryCacheEx.Add(2, TimeEx.GetTimestamp(), this._expiration, this.CacheItemRemovedCallback);
                MemoryCacheEx.Add(3, TimeEx.GetTimestamp(), TimeSpan.FromMilliseconds(this._expiration), this.CacheItemRemovedCallback);
                MemoryCacheEx.Add(4, TimeEx.GetTimestamp(), (t) => { return((DateTimeOffset.Now - t.AddTime).TotalMilliseconds > this._expiration * 2); }, this.CacheItemRemovedCallback);

                CacheItem cacheItem = new CacheItem(5, TimeEx.GetTimestamp());
                cacheItem.AbsoluteExpiration = DateTimeOffset.Now.AddMilliseconds(this._expiration);
                //cacheItem.SlidingExpiration = slidingExpiration;
                //cacheItem.CustomerExpiration = customerExpiration;
                cacheItem.RemovedCallback = this.CacheItemRemovedCallback;
                //cacheItem.InnerRemovedCallback = true;
                MemoryCacheEx.Add(cacheItem);
            }
            catch (Exception ex)
            {
                Loger.Error(ex);
            }
        }
Example #3
0
    private void Initialize()
    {
        TimeEx.Initialize();

        GlobalManager.Instance.Initialize(gameObject);
        GlobalManager.Instance.Add <GameShellManager>();
        GlobalManager.Instance.Add <GameStateMachineManager>().EnterState <GameStateInitializing>();
    }
Example #4
0
 public void Update(int mtu, int rto, bool isTimeout)
 {
     Timestamp      = TimeEx.GetTimestamp();
     HasValue       = true;
     this.IsTimeout = isTimeout;
     Mtu            = mtu;
     Rto            = rto;
 }
Example #5
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="rid"></param>
        /// <param name="position"></param>
        /// <param name="size"></param>
        public ResourceRequestMessage(Int32 rid, Int64 position, Int32 size)
            : base(new CommonHeader(TransferCommands.ResourceRequest, TimeEx.GetTimestamp(), rid))
        {
            this.ContextId = GUIDEx.GetGUIDHashCode();

            this.Position = position;
            this.Size     = size;
        }
Example #6
0
    void Update()
    {
        if (HealthPoint() == 0)
        {
            return;
        }

        if (hitCooldown > 0)
        {
            bool enable;
            if (TimeEx.Cooldown(ref hitCooldown) == 0)
            {
                enable = true;
            }
            else
            {
                enable = ((int)((hitCooldown_unit - hitCooldown) / hitEffect_unit) & 1) != 0;
            }

            spriteRenderer.enabled = enable;
            //자식 렌더러는 어케끄냐
        }


        Vector2 movement = new Vector2(0, 0);

        if (Input.GetKey(KeyCode.A))
        {
            movement.x--;
        }
        if (Input.GetKey(KeyCode.D))
        {
            movement.x++;
        }
        if (Input.GetKey(KeyCode.W))
        {
            movement.y++;
        }
        if (Input.GetKey(KeyCode.S))
        {
            movement.y--;
        }
        movement           *= velocity * Time.deltaTime;
        transform.position += new Vector3(movement.x, movement.y);

        animator.SetBool("isMoving", (movement.x != 0) || (0 != movement.y));


        UpdateDirection();


        if (Input.GetKey(KeyCode.Mouse0))
        {
            myWeaponScript.WeaponFire();
        }
    }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="writer"></param>
 /// <returns></returns>
 public bool WriteXmlHeader(XmlTextWriter writer)
 {
     // <entry char="g" value="103" time="63604023814.284" />
     writer.WriteStartElement("Entry");
     writer.WriteAttributeString("char", XmlConvert.ToString(this.Char));
     writer.WriteAttributeString("value", XmlConvert.ToString(this.Code));
     writer.WriteAttributeString("ticks", XmlConvert.ToString(this.Ticks));
     writer.WriteAttributeString("seconds", XmlConvert.ToString(TimeEx.Ticks2Sec(this.Ticks, 2)));
     writer.WriteEndElement(); // </Entry>
     return(true);
 }
Example #8
0
 // Update is called once per frame
 void Update()
 {
     if (grenade.IsBraked())
     {
         if (TimeEx.Cooldown(ref fuse) == 0)
         {
             GameObject explosion = Instantiate(explosionPrefab);
             explosion.transform.position = transform.position;
             Destroy(gameObject);
         }
     }
 }
Example #9
0
        private void SetValue(DotnetWinFormApp.DB.IStu stu, long id = -1)
        {
            if (id == -1)
            {
                id = TimeEx.GetTimestamp();
            }

            stu.ID   = id;
            stu.Age  = _rnd.Next(0, 120);
            stu.Name = "yf" + id;
            //stu.Bir = new DateTime(1988, 11, 30, 2, 22, 45);
            stu.Bir = DateTime.Now;
        }
Example #10
0
        internal void ProResourceResponse(ResourceResponseMessage message, byte[] revData)
        {
            try
            {
                if (message.Size == ResourceResponseMessage.RESOURCE_NOT_EXIST)
                {
                    //资源不存在,发送超时,将接收数据移除
                    Loger.Warn("请求资源不存在");
                }
                else
                {
                    int mtu = message.Size + ResourceResponseMessage.HEAD_SIZE;
                    int rto = (int)(TimeEx.GetTimestamp() - message.Header.Timestamp);
                    TransferParaManager.RecordMtuAndRto(message.SrcEndPoint, mtu, rto, false);

                    ReceiveDataItem receiveDataItem;
                    if (this._revItemDic.TryGetValue(message.Header.Rid, out receiveDataItem))
                    {
                        //发送收到响应数据通知
                        EventWaitHandle eventHandle = AutoEventWaitHandleManager.GetEventWaitHandle(message.ContextId);
                        if (eventHandle != null)
                        {
                            try
                            {
                                receiveDataItem.UpdateLastAccessTimestamp();
                                if (message.Size == ResourceResponseMessage.RESOURCE_NOT_EXIST)
                                {
                                    return;
                                }

                                receiveDataItem.Write(message.Position, revData, ResourceResponseMessage.HEAD_SIZE, message.Size);
                                eventHandle.Set();
                            }
                            catch (ObjectDisposedException)
                            { }
                        }
                    }
                    else
                    {
                        //var tt = TimeEx.GetTimestamp();
                        //Loger.Warn($"未知的资源ID:{message.Header.Rid},[ContextId:{message.ContextId}],[请求响应时长:{tt - message.Header.Timestamp}],[请求数据Position:{message.Position},Size:{message.Size}],[线程:{Thread.CurrentThread.Name}]");
                    }
                }
            }
            catch (Exception ex)
            {
                Loger.Error(ex, "ProResourceResponse发生异常");
            }
        }
        private void btnSet_Click(object sender, RoutedEventArgs e)
        {
            MemoryCacheEx.Set(1, TimeEx.GetTimestamp());
            MemoryCacheEx.Set(2, TimeEx.GetTimestamp(), this._expiration, this.CacheItemRemovedCallback);
            MemoryCacheEx.Set(3, TimeEx.GetTimestamp(), TimeSpan.FromMilliseconds(this._expiration), this.CacheItemRemovedCallback);
            MemoryCacheEx.Set(4, TimeEx.GetTimestamp(), (t) => { return((DateTimeOffset.Now - t.AddTime).TotalMilliseconds > this._expiration * 2); }, this.CacheItemRemovedCallback);

            CacheItem cacheItem = new CacheItem(5, TimeEx.GetTimestamp());

            cacheItem.AbsoluteExpiration = DateTimeOffset.Now.AddMilliseconds(this._expiration);
            //cacheItem.SlidingExpiration = slidingExpiration;
            //cacheItem.CustomerExpiration = customerExpiration;
            cacheItem.RemovedCallback = this.CacheItemRemovedCallback;
            //cacheItem.InnerRemovedCallback = true;
            MemoryCacheEx.Set(cacheItem);
        }
Example #12
0
        private void SendTransferCompletedMessage(SendDataNotifyMessage notifyMessage)
        {
            var transferCompletedMessage = new TransferCompletedMessage(notifyMessage);
            var buffer          = transferCompletedMessage.GenerateBuffer();
            var id              = CacheKeyGenerator.GenerateWaitTransferCompletedAckMessageEventWaitHandleId(notifyMessage.Header.Rid);
            var eventHandleInfo = AutoEventWaitHandleManager.CreateEventWaitHandle(id);

            try
            {
                long beginTs = TimeEx.GetTimestamp();
                long endTs   = beginTs;

                while (!notifyMessage.IsTimeout(beginTs, endTs))
                {
                    try
                    {
                        int rto = TransferParaManager.GetRto(notifyMessage.SrcEndPoint);
                        this._net.Send(buffer, notifyMessage.SrcEndPoint);
                        if (eventHandleInfo.EventWaitHandle.WaitOne(rto))
                        {
                            break;
                        }
                        else
                        {
                            TransferParaManager.AdjustUpRto(notifyMessage.SrcEndPoint);
                        }
                    }
                    catch (SendDataException)
                    {
                        break;
                    }
                    catch (Exception ex)
                    {
                        Loger.Error(ex, "发送传输完成消息异常");
                    }

                    endTs = TimeEx.GetTimestamp();
                }
            }
            finally
            {
                AutoEventWaitHandleManager.RemoveEventWaitHandle(id);
                eventHandleInfo.EventWaitHandle.Dispose();
            }

            //注:如果一直都没有收到确认消息,则超时线程处理
        }
Example #13
0
        /// <summary>
        /// 初始化文件流
        /// </summary>
        /// <param name="dir"></param>
        /// <param name="fileName"></param>
        protected void InitFileStream(string dir, string fileName)
        {
            if (string.IsNullOrWhiteSpace(fileName))
            {
                fileName = $"{TimeEx.GetTimestamp()}.dat";
            }

            string filePath = Path.Combine(dir, fileName);

            this._filePath = filePath;
            this._flag     = false;
            for (int i = 0; i < this._streamArr.Length; i++)
            {
                this._streamArr[i] = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write);
                this._streams.Add(this._streamArr[i]);
            }
        }
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="resoucesInfo"></param>
        public SendDataNotifyMessage(ResoucesInfo resoucesInfo)
            : base(new CommonHeader(TransferCommands.SendNotify, TimeEx.GetTimestamp(), resoucesInfo.Rid))
        {
            this.Priority = resoucesInfo.Policy.Priority;
            byte sendMode;

            if (resoucesInfo.Length <= TransferConstant.MESSAGE_MAX_SIZE)
            {
                var data = new byte[resoucesInfo.Length];
                Array.Copy(resoucesInfo.Data, resoucesInfo.Postion, data, 0, data.Length);
                this.Data = data;
                sendMode  = ResourceTypeConstant.Message;
            }
            else
            {
                switch (resoucesInfo.ResoucesType)
                {
                case TransferDataType.Data:
                    sendMode = ResourceTypeConstant.ResourceData;
                    break;

                case TransferDataType.Stream:
                    sendMode = ResourceTypeConstant.ResourceStream;
                    break;

                case TransferDataType.File:
                    sendMode      = ResourceTypeConstant.ResourceFile;
                    this.FileName = Path.GetFileName(resoucesInfo.FilePath);
                    break;

                default:
                    throw new NotImplementedException($"未实现的资源类型:{resoucesInfo.ResoucesType.ToString()}");
                }
            }

            this.ResourceType = sendMode;
            this.Timeout      = resoucesInfo.Policy.MillisecondsTimeout;
            this.Size         = resoucesInfo.Length;
        }
Example #15
0
        /// <summary>
        /// Writes this session object out as an XML log, which can be read in at a later time to
        /// "re-inflate" this session object.
        /// </summary>
        /// <param name="writer"></param>
        /// <returns>True if successful; false otherwise.</returns>
        public bool WriteXmlHeader(XmlTextWriter writer)
        {
            bool success = true;

            try
            {
                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);
                writer.WriteStartElement("TextTest");
                Version v = Assembly.GetExecutingAssembly().GetName().Version;
                writer.WriteAttributeString("version", String.Format("{0}.{1}.{2}", v.Major, v.Minor, v.Build));
                writer.WriteAttributeString("trials", XmlConvert.ToString(this.NumTrials));
                writer.WriteAttributeString("ticks", XmlConvert.ToString(this.Ticks));
                writer.WriteAttributeString("seconds", XmlConvert.ToString(TimeEx.Ticks2Sec(this.Ticks, 2)));
                DateTime dt = new DateTime(this.Ticks);
                writer.WriteAttributeString("date", String.Format("{0} {1}", dt.ToLongDateString(), dt.ToLongTimeString()));

                // write out the individual trials
                for (int i = 0; i < this.NumTrials; i++)
                {
                    _trials[i].WriteXmlHeader(writer);
                    _trials[i].WriteXmlFooter(writer);
                }

                writer.WriteEndDocument(); // </TextTest>
            }
            catch (XmlException xex)
            {
                Console.WriteLine(xex);
                success = false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                success = false;
            }
            return(success);
        }
Example #16
0
    protected override void StateUpdate()
    {
        if (BehaviorState.Bike_riding == state)
        {
            if (PlayerTracking())
            {
                if (Vector2.Distance(Vector2ex.By3(GameObject.FindWithTag("Player").transform.position), Vector2ex.By3(transform.position)) < 100)
                {
                    SetState_BikeOut();
                    animator.SetTrigger("isBikeFinish");
                }
            }



            //으아 길찾기
            if (TimeEx.Cooldown(ref astar_cooldown) == 0)
            {
                astar_cooldown = 0.5f;
                if ((astar_lastSucceeded = astarPathFinder.경로검색(GameObject.FindWithTag("Player").transform.position)) == true)
                {
                    List <Astar.최단경로노드> path = astarPathFinder.GetPath();
                    astar_index      = 0;
                    astar_dir        = Vector2ex.By3(path[0].월드위치) - Vector2ex.By3(transform.position);
                    astar_remainDist = astar_dir.magnitude;
                    astar_dir       /= astar_remainDist;
                }
            }
            if (astar_lastSucceeded)
            {
                float movement = bikeSpeed * Time.deltaTime;
                while (true)
                {
                    if (astar_remainDist < movement)
                    {
                        transform.position += Vector2ex.To3(astar_dir) * astar_remainDist;
                        movement           -= astar_remainDist;


                        List <Astar.최단경로노드> path = astarPathFinder.GetPath();
                        astar_index++;
                        if (astar_index >= path.Count)
                        {
                            astar_cooldown = 0;
                            break;
                        }
                        astar_dir        = Vector2ex.By3(path[astar_index].월드위치) - Vector2ex.By3(transform.position);
                        astar_remainDist = astar_dir.magnitude;
                        astar_dir       /= astar_remainDist;
                    }
                    else
                    {
                        transform.position += Vector2ex.To3(astar_dir) * movement;
                        astar_remainDist   -= movement;
                        break;
                    }
                }
            }

            lrFliper.In(astar_dir);
        }
        else if (BehaviorState.Bike_out == state)
        {
            float movement = bikeSpeed * Time.deltaTime;
            transform.position += Vector2ex.To3(astar_dir) * movement;
        }
        else if (BehaviorState.Attack_machinegun == state ||
                 BehaviorState.Attack_machinegun_prefire == state ||
                 BehaviorState.Attack_grenadelauncher == state)
        {
            if (PlayerTracking())
            {
                GameObject player  = GameObject.FindWithTag("Player");
                Vector2    destDir = (Vector2ex.By3(player.transform.position) - Vector2ex.By3(transform.position)).normalized;

                float angle = Vector2.Angle(destDir, direction);
                if (angle <= weaponRotateSpeed * Time.deltaTime)
                {
                    if (state == BehaviorState.Attack_grenadelauncher)
                    {
                        weapon_GrenadeLauncher.WeaponFire();
                    }
                    else
                    {
                        weapon_MG.WeaponFire();
                    }
                    direction = destDir;
                }
                else
                {
                    bool isRevClockwise = direction.x * destDir.y - direction.y * destDir.x >= 0;
                    direction = Vector2ex.Rotate(direction, weaponRotateSpeed * Mathf.Deg2Rad * Time.deltaTime * (isRevClockwise ? 1 : -1));
                }
            }
            else
            {
                if (BehaviorState.Attack_machinegun == state)
                {
                    stateTime -= 1;
                    if (stateTime <= 0)
                    {
                        SetState_Idle();
                    }
                    else
                    {
                        SetState_AttackMachinegun_Prefire();
                    }
                }
            }
        }
        else if (BehaviorState.Moving == state)
        {
            transform.position += Vector2ex.To3(direction);
        }
    }
Example #17
0
    void waitRangeFire(WeaponType shotType)
    {
        //calculate count
        int parallelCount = 1;

        switch (shotType)
        {
        case WeaponType.WEAPON_SPREAD: parallelCount = 5; break;
        }

        //iter for shot
        foreach (double timestamp in ammosDic.Keys)
        {
            Debug.Log("shotTimestamp: " + timestamp.ToString());
            Debug.Log("nowTimestamp: " + TimeEx.getTimeStamp());

            //when receive timeout, means failing, we just mark it
            if (TimeEx.getTimeStamp() - timestamp > timeout)
            {
                timeoutkeys.Add(timestamp);
                continue;
            }

            //ready for shot
            List <GameObject> ammos = ammosDic[timestamp];
            if (ammos.Count >= parallelCount)
            {
                for (int i = 0; i < ammos.Count; i++)
                {
                    //set transform
                    GameObject ammo   = ammos[i];
                    GameObject master = ammo.GetComponent <Projectile>().m_Master;
                    ammo.transform.position = master.transform.position;
                    ammo.transform.Rotate(0, 20.0f - 10.0f * i, 0);

                    //set sync transfrom
                    SyncPosRot syncScript = ammo.GetComponent <SyncPosRot>();
                    if (!syncScript.isLocalPlayer)
                    {
                        syncScript.RealSync(ammo);
                    }

                    //active
                    ammo.SetActive(true);
                }
                ammos.Clear();
                ammosDic.Remove(timestamp);
                break;
            }
        }

        //clear timeout data
        foreach (double timestamp in timeoutkeys)
        {
            List <GameObject> ammos = ammosDic[timestamp];
            for (int i = 0; i < ammos.Count; i++)
            {
                GameObject ammo = ammos[i];
                ammo.GetComponent <Projectile>().Safe_Destroy();
            }
            ammos.Clear();
            ammosDic.Remove(timestamp);
        }
        timeoutkeys.Clear();
    }
Example #18
0
 public override void SetTimeEx(TimeEx value)
 {
     m_text = "'" + value.ToString("HH:mm:ss.fff", CultureInfo.InvariantCulture) + "'";
 }
Example #19
0
 public override void SetTimeEx(TimeEx value)
 {
     m_text = "timestamp'" + value.ToString("0001-01-01 HH:mm:ss.fff", DateTimeFormatInfo.InvariantInfo) + "'";
 }
Example #20
0
 public System.DateTime ToServerDateTime(long time)
 {
     return(TimeEx.ToUTCDateTime(time).AddHours(serverTimeZone));
 }
Example #21
0
 /// <summary>
 /// 创建
 /// </summary>
 /// <param name="sendDataNotifyMessage"></param>
 public TransferCompletedMessage(SendDataNotifyMessage sendDataNotifyMessage)
     : base(new CommonHeader(TransferCommands.TransferCompleted, TimeEx.GetTimestamp(), sendDataNotifyMessage.Header.Rid))
 {
 }
Example #22
0
        public static void ReadValue(SQLiteDataReader reader, int index, TypeStorage type, ICdlValueWriter writer)
        {
            switch (type)
            {
            case TypeStorage.Boolean:
                writer.SetBoolean(reader.GetInt32(index) != 0);
                break;

            case TypeStorage.Byte:
                writer.SetByte((byte)reader.GetInt32(index));
                break;

            case TypeStorage.Int16:
                writer.SetInt16((short)reader.GetInt32(index));
                break;

            case TypeStorage.Int32:
                writer.SetInt32((int)reader.GetInt32(index));
                break;

            case TypeStorage.Int64:
                writer.SetInt64((long)reader.GetInt64(index));
                break;

            case TypeStorage.SByte:
                writer.SetSByte((sbyte)reader.GetInt32(index));
                break;

            case TypeStorage.UInt16:
                writer.SetUInt16((ushort)reader.GetInt32(index));
                break;

            case TypeStorage.UInt32:
                writer.SetUInt32((uint)reader.GetInt32(index));
                break;

            case TypeStorage.UInt64:
                writer.SetUInt64((ulong)reader.GetInt64(index));
                break;

            case TypeStorage.DateTime:
                writer.SetDateTime(DateTime.Parse(reader.GetString(index), CultureInfo.InvariantCulture));
                //writer.SetDateTime(DateTime.ParseExact(reader.GetString(index), "s", CultureInfo.InvariantCulture));
                break;

            case TypeStorage.DateTimeEx:
                writer.SetDateTimeEx(DateTimeEx.ParseNormalized(reader.GetString(index)));
                break;

            case TypeStorage.DateEx:
                writer.SetDateEx(DateEx.ParseNormalized(reader.GetString(index)));
                break;

            case TypeStorage.TimeEx:
                writer.SetTimeEx(TimeEx.ParseNormalized(reader.GetString(index)));
                break;

            case TypeStorage.Decimal:
            {
                var     dtype = reader.GetFieldType(index);
                decimal value;
                if (dtype == typeof(string))
                {
                    value = Decimal.Parse(reader.GetString(index), CultureInfo.InvariantCulture);
                }
                else
                {
                    value = (decimal)reader.GetDouble(index);
                }
                writer.SetDecimal(value);
            }
            break;

            case TypeStorage.Float:
                writer.SetFloat((float)reader.GetDouble(index));
                break;

            case TypeStorage.Double:
                writer.SetDouble((double)reader.GetDouble(index));
                break;

            case TypeStorage.String:
                writer.SetString(reader.GetString(index));
                break;

            case TypeStorage.Guid:
                writer.SetGuid(new Guid(reader.GetString(index)));
                break;

            case TypeStorage.ByteArray:
                writer.SetByteArray((byte[])reader.GetValue(index));
                break;

            case TypeStorage.Null:
                writer.SetNull();
                break;

            default:
                throw new Exception("DBSH-00167 Unsupported field type:" + type.ToString());
            }
        }
Example #23
0
 public void SetTimeEx(TimeEx value)
 {
     _values[_curWriteField] = value;
     Changed();
 }
Example #24
0
 public ConfigChildItem2(bool flag)
 {
     this.ID  = TimeEx.GetTimestamp();
     this.Bir = DateTime.Now;
 }
Example #25
0
    void waitShot()
    {
        //iter for shot
        foreach (double timestamp in arrowsDic.Keys)
        {
            //Debug.Log("shotTimestamp: " + timestamp.ToString());
            //Debug.Log("nowTimestamp: " + TimeEx.getTimeStamp());

            //when receive timeout, means failing, we just mark it
            if (TimeEx.getTimeStamp() - timestamp > timeout)
            {
                timeoutkeys.Add(timestamp);
                continue;
            }

            //calculate count
            List <GameObject> arrows    = arrowsDic[timestamp];
            AttackType        attckType = 0;
            int parallelCount           = 1;
            if (arrows.Count > 0)
            {
                KBEngine.Arrow kbeArrow = (KBEngine.Arrow)arrows[0].GetComponent <SyncPosRot>().entity;
                attckType = (AttackType)kbeArrow.attackType;
                switch (attckType)
                {
                case AttackType.Frozen:
                    parallelCount = 5;
                    break;

                case AttackType.Normal:
                case AttackType.Strong:
                case AttackType.Shadow:
                    parallelCount = 1;
                    break;
                }
            }

            //ready for shot
            if (arrows.Count >= parallelCount)
            {
                GameObject master = null;
                for (int i = 0; i < arrows.Count; i++)
                {
                    //set transform
                    GameObject arrow = arrows[i];
                    if (arrow.GetComponent <SyncPosRot>().isLocalPlayer)
                    {
                        master = arrow.GetComponent <Arrow>().master;
                        arrow.transform.position = getShotTrans(master).position;
                        float delta  = 15f;
                        float yAngle = (int)((i + 1) / 2) * (i % 2 == 0 ? delta : -delta);
                        arrow.transform.Rotate(0, yAngle, 0);
                    }

                    //active
                    arrow.SetActive(true);
                }
                if (master != null)
                {
                    master.GetComponent <SyncPosRot>().entity.cellCall("reqActiveArrows", new object[] { timestamp });
                }
                arrows.Clear();
                arrowsDic.Remove(timestamp);

                break;
            }
        }

        //clear timeout data
        foreach (double timestamp in timeoutkeys)
        {
            List <GameObject> arrows = arrowsDic[timestamp];
            for (int i = 0; i < arrows.Count; i++)
            {
                GameObject arrow = arrows[i];
                arrow.GetComponent <Arrow>().Safe_Destroy();
            }
            arrows.Clear();
            arrowsDic.Remove(timestamp);
        }
        timeoutkeys.Clear();
    }
Example #26
0
 public virtual void SetTimeEx(TimeEx value)
 {
     m_text = "'" + value.ToStringNormalized() + "'";
 }
Example #27
0
    void Update()
    {
        lrFliper.In(weaponOwner.Direction());

        TimeEx.Cooldown(ref cooldown);
    }