Example #1
0
    public void OnClickSelectBtn(int index)
    {
        selectedIndex = index;
        stealTips.gameObject.SetActive(false);

        for (int i = 0; i < buttons.Length; i++)
        {
            buttons[i].gameObject.SetActive(false);
        }
        GameMainManager.instance.netManager.Steal(selectedIndex, (ret, res) =>
        {
            if (res.isOK)
            {
                StealData stealData       = res.data;
                TargetData selectedTarget = stealData.targets[selectedIndex];

                GameMainManager.instance.audioManager.PlaySound(AudioNameEnum.steal_result);
                Sequence sq = DOTween.Sequence();

                for (int i = 0; i < islands.Length; i++)
                {
                    if (i != selectedIndex)
                    {
                        islands[i].setData(stealData.targets[i]);
                        sq.Insert(3, (islands[i].transform as RectTransform).DOAnchorPos(goAwayPos[i], 1));
                    }
                    else
                    {
                        sq.Insert(3, (islands[i].transform as RectTransform).DOAnchorPos(new Vector2(0, -100), 1));
                        sq.Insert(3, (islands[i].transform as RectTransform).DOScale(new Vector3(2, 2, 2), 1));
                    }
                }
                sq.Append(topBar.DOAnchorPos(new Vector2(0, 150), 0.5f).SetEase(Ease.OutCubic));
                sq.InsertCallback(3f, () =>
                {
                    effect.gameObject.SetActive(true);
                });
                sq.InsertCallback(5, () =>
                {
                    effect.gameObject.SetActive(false);
                    islands[selectedIndex].setData(selectedTarget);
                    goldEffect.SetActive(true);
                    EventDispatcher.instance.DispatchEvent(new UpdateBaseDataEvent(UpdateBaseDataEvent.UpdateType.Money, 0));
                    if (stealData.targets[selectedIndex].isRichMan)
                    {
                        GameMainManager.instance.audioManager.PlaySound(AudioNameEnum.steal_got_king);
                        victoryTip.gameObject.SetActive(true);

                        Alert.ShowPopupBox(string.Format("恭喜你猜到富豪!\n获得<#D34727FF>{0}</color>金币", GameUtils.GetCurrencyString(selectedTarget.money)), OnClickOkBtn);
                    }
                    else
                    {
                        GameMainManager.instance.audioManager.PlaySound(AudioNameEnum.steal_miss_king);

                        Alert.ShowPopupBox(string.Format("很遗憾没有猜到富豪!\n只得到<#D34727FF>{0}</color>金币", GameUtils.GetCurrencyString(selectedTarget.money)), OnClickOkBtn);
                    }
                });
            }
        });
    }
Example #2
0
        //list tests
        public static IList <Test> GetTestsSystemLevel(Machine TargetName, MachinePool testPool, Project project)
        {
            IList <Test> Test_List = new List <Test> {
            };

            try
            {
                OSPlatform      platform = testPool.GetMachines().First().OSPlatform;
                ProductInstance pi       = project.CreateProductInstance(project.Name, testPool, platform);
                TargetData      data     = pi.FindTargetFromSystem(TargetName);
                if (data == null)
                {
                    Log("Error! No target data found in system " + TargetName.Name);
                    Console.ReadLine();
                    return(Test_List);
                }
                pi.CreateTarget(data);
                IList <Test> tests = project.GetTests();
                if (tests.Count == 0)
                {
                    Log("Warning! Test list count is 0");
                    Console.ReadLine();
                    return(Test_List);
                }
                Test_List = tests;
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception :- {0}", e.ToString());
            }
            return(Test_List);
        }
Example #3
0
 public void SetStealerData(TargetData target)
 {
     if (stealTarget != null && stealTarget.uid != target.uid)
     {
         CanvasGroup canvasGroup = stealHead.transform.parent.GetComponent <CanvasGroup>();
         Sequence    sq          = DOTween.Sequence();
         sq.AppendInterval(2);
         sq.Append(stealHead.transform.parent.DOScale(new Vector3(1.5f, 1.5f, 1.5f), 1));
         sq.Insert(2, canvasGroup.DOFade(0, 1));
         sq.AppendCallback(() =>
         {
             stealNameLabel.text  = target.name;
             stealMoneyLabel.text = GameUtils.GetCurrencyString(target.money);
             stealHead.transform.parent.DOScale(Vector3.one, 1);
             canvasGroup.DOFade(1, 1);
             AssetLoadManager.Instance.LoadAsset <Texture2D>(target.headImg, (text) =>
             {
                 stealHead.texture = text;
             });
         });
     }
     else if (stealTarget == null)
     {
         stealNameLabel.text  = target.name;
         stealMoneyLabel.text = GameUtils.GetCurrencyString(target.money);
         AssetLoadManager.Instance.LoadAsset <Texture2D>(target.headImg, (text) =>
         {
             stealHead.texture = text;
         });
     }
     stealTarget = target;
 }
Example #4
0
 public void SetUpTargets(TargetData targetData, GameEnums.TrackingGroup trackingGroup)
 {
     for (int i = 0; i < TrackingGroupsDictionary[trackingGroup].Count; i++)
     {
         TrackingGroupsDictionary[trackingGroup][i].SetTargetData(targetData);
     }
 }
Example #5
0
    //Modifies this by target data mod
    public void modify(TargetData mod)
    {
        bool targets_enemy     = (enemyL || enemyM || enemyR);
        bool targets_ally      = (allyL || allyM || allyR);
        bool mod_targets_enemy = (mod.enemyL || mod.enemyM || mod.enemyR);
        bool mod_targets_ally  = (mod.allyL || mod.allyM || mod.allyR);

        if (targets_enemy && targets_ally && mod_targets_ally && mod_targets_enemy)
        {
            enemyL     = mod.enemyL;
            enemyM     = mod.enemyM;
            enemyR     = mod.enemyR;
            allyL      = mod.allyL;
            allyM      = mod.allyM;
            allyR      = mod.allyR;
            targeted   = mod.targeted;
            selfCenter = mod.selfCenter;
        }
        else if (targets_enemy)
        {
            enemyL   = mod.enemyL;
            enemyM   = mod.enemyM;
            enemyR   = mod.enemyR;
            targeted = mod.targeted;
        }
        else if (targets_ally)
        {
            allyL      = mod.allyL;
            allyM      = mod.allyM;
            allyR      = mod.allyR;
            selfCenter = mod.selfCenter;
        }
    }
Example #6
0
        // HandleCancelTarget
        private void HandleCancelTarget(byte[] data)
        {
            try
            {
                if (MyAPIGateway.Session == null)
                {
                    return;
                }

                if (NaniteConstructionManager.NaniteBlocks == null)
                {
                    return;
                }

                TargetData target = MyAPIGateway.Utilities.SerializeFromXML <TargetData>(ASCIIEncoding.ASCII.GetString(data));
                foreach (var item in NaniteConstructionManager.NaniteBlocks)
                {
                    if (item.Key == target.EntityId)
                    {
                        item.Value.SyncCancelTarget(target);
                    }
                }
            }
            catch (Exception ex)
            {
                MyLog.Default.WriteLine(string.Format("HandleCancelTarget Error: {0}", ex.ToString()));
            }
        }
Example #7
0
        public bool IsValid(TargetData data)
        {
            if (this.checkPlatform == true)
            {
                if (System.Array.IndexOf(this.runtimePlatforms, data.platform) < 0)
                {
                    return(false);
                }
            }

            if (this.checkAspects == true)
            {
                var aspect = data.screenSize.x / data.screenSize.y;
                for (int i = 0; i < this.aspects.items.Length; ++i)
                {
                    var item = this.aspects.items[i];
                    var from = item.aspectFrom.x / item.aspectFrom.y;
                    var to   = item.aspectTo.x / item.aspectTo.y;
                    var min  = Mathf.Min(from, to);
                    var max  = Mathf.Min(from, to);
                    if (aspect < min || aspect > max)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #8
0
        protected bool DestroyOnAnyTargetHit(Entity bulletEntity, BulletComponent bullet, BulletConfigComponent config, TargetingData targeting)
        {
            bool flag;

            using (List <DirectionData> .Enumerator enumerator = targeting.Directions.GetEnumerator())
            {
                while (true)
                {
                    if (enumerator.MoveNext())
                    {
                        DirectionData current = enumerator.Current;
                        if (current.Targets.Count <= 0)
                        {
                            continue;
                        }
                        TargetData data2 = current.Targets.First <TargetData>();
                        this.SetPositionNearHitPoint(bullet, data2.HitPoint);
                        this.SendBulletTargetHitEvent(bulletEntity, bullet, data2.TargetEntity);
                        this.DestroyBullet(bulletEntity);
                        flag = true;
                    }
                    else
                    {
                        return(false);
                    }
                    break;
                }
            }
            return(flag);
        }
Example #9
0
    static void AddTranslateScaleChains(TranslateScale.TranslateScaleChain translateScaleChain)
    {
        if (!translateScaleChain.HasValidData())
        {
            return;
        }

        GameDebug.Assert(s_SourceJoints.length < k_MaxDrivers, "You are trying to add more translate scale chains then there is allocated space for.");
        GameDebug.Assert(s_DrivenJoints.length + translateScaleChain.drivenJoints.Count <= k_MaxDrivenJoints, "You are trying to add more driven joint then there is allocated space for.");

        s_SourceJoints.Add(translateScaleChain.driver);
        s_SourceData[s_DriverIndex] = new SourceData
        {
            bindpose = translateScaleChain.bindpose
        };

        for (var j = 0; j < translateScaleChain.drivenJoints.Count; j++)
        {
            if (translateScaleChain.drivenJoints[j].joint != null)
            {
                s_DrivenJoints.Add(translateScaleChain.drivenJoints[j].joint);
                s_TargetData[s_DrivenIndex] = new TargetData
                {
                    sourceIndex   = s_DriverIndex,
                    bindpose      = translateScaleChain.drivenJoints[j].bindpose,
                    stretchFactor = translateScaleChain.drivenJoints[j].strectchFactor,
                    scaleFactor   = translateScaleChain.drivenJoints[j].scaleFactor
                };
                s_DrivenIndex++;
            }
        }

        s_DriverIndex++;
    }
    public void Show()
    {
        if (targetList.GetCount() == 0)
        {
            return;
        }

        if (targetList.GetCount() == 1)
        {
            targetData = (TargetData)targetList.GetListItem(0).GetItemData();
            ChangeToTargetCommands();
            targetList.Clear();
            return;
        }

        state = 0;

        if (menuAnim == null)
        {
            menuAnim = GetComponent <MenuDisplayAnim>();
        }

        menuAnim.SetAnim(MenuDisplayAnim.AnimType.InsertFromRight);

        gameObject.SetActive(true);
    }
    void OnTargetItemClickHandler()
    {
        state = 1;
        menuAnim.SetAnim(MenuDisplayAnim.AnimType.OutToRight);

        targetData = (TargetData)targetList.GetSelectItem().GetItemData();
    }
Example #12
0
 public void SendHitEvent(TargetingEvent e, SingleNode <BulletComponent> bulletNode, [JoinByTank] UnblockedWeaponNode weaponNode, [JoinByTank] SingleNode <TankSyncComponent> tankNode)
 {
     if (!e.TargetingData.HasBaseStaticHit())
     {
         foreach (DirectionData data in e.TargetingData.Directions)
         {
             if (data.HasTargetHit())
             {
                 TargetData targetData = data.Targets.First <TargetData>();
                 if (targetData.TargetEntity.HasComponent <TankActiveStateComponent>())
                 {
                     this.PrepareTargetData(targetData, bulletNode.component);
                     SelfHitEvent     event3 = new SelfHitEvent();
                     List <HitTarget> list   = new List <HitTarget> {
                         HitTargetAdapter.Adapt(targetData)
                     };
                     event3.Targets = list;
                     event3.ShotId  = bulletNode.component.ShotId;
                     SelfHitEvent eventInstance = event3;
                     base.ScheduleEvent(eventInstance, weaponNode.Entity);
                     break;
                 }
             }
         }
     }
 }
Example #13
0
        public void DeleteTargetFromAction(TargetData targetData)
        {
            Target target = FindNote(targetData);

            if (target == null)
            {
                return;
            }

            notes.Remove(target);
            orderedNotes.Remove(target);
            loadedNotes.Remove(target);
            selectedNotes.Remove(target);

            if (target.gridTargetIcon)
            {
                Destroy(target.gridTargetIcon.gameObject);
            }

            if (target.timelineTargetIcon)
            {
                Destroy(target.timelineTargetIcon.gameObject);
            }

            target = null;
        }
Example #14
0
        public Target FindNote(TargetData data)
        {
            int idx = BinarySearchOrderedNotes(data.beatTime);

            if (idx == -1)
            {
                Debug.Log("Couldn't find note with time " + data.beatTime);
                return(null);
            }

            for (int i = idx; i < orderedNotes.Count; ++i)
            {
                Target  t   = orderedNotes[i];
                Vector3 pos = t.gridTargetIcon.transform.localPosition;
                if (Mathf.Approximately(pos.x, data.x) &&
                    Mathf.Approximately(pos.y, data.y) &&
                    Mathf.Approximately(pos.z, data.beatTime) &&
                    t.handType == data.handType)
                {
                    return(t);
                }
            }

            Debug.Log("Couldn't find note with time " + data.beatTime + " and index " + idx);
            return(null);
        }
    public override List<Ilife> GetTargetList(Ilife thisUnit, TargetData data, FuncContext context)
    {
        List<Ilife> res = new List<Ilife>();

        if (thisUnit == null)
        {
            return res;
        }
        Vector3 point = ((ITransformBehaviour) (thisUnit)).GetTransformData().GetPosition();
        float r = ((ITransformBehaviour)(thisUnit)).GetTransformData().GetScale().x;
        var lifeList = LifeManager.GetLifeList();
        foreach (var elem in lifeList)
        {
            if (elem.Key == thisUnit.GetInstanceId())
            {
                continue;
            }
           Ilife otherLifes = elem.Value;
           Vector3 point1 = ((ITransformBehaviour)(otherLifes)).GetTransformData().GetPosition();
           if (Vector3.Distance(point, point1) < r)
           {
               // add to target list
               res.Add(otherLifes);
           }
        }
        return res;
    }
        public void EvaluateTeamTank(IsisEvaluateTeamTankEvent e, WeaponNode weapon, TeamTankNode targetTank)
        {
            TargetData targetData = e.TargetData;

            if (e.ShooterTeamKey != targetTank.teamGroup.Key)
            {
                base.Log.Debug("EvaluateTeamTank: enemy team");
                targetData.Priority += 2f;
            }
            else
            {
                base.Log.Debug("EvaluateTeamTank: same team");
                targetData.Priority++;
                HealthComponent health = targetTank.health;
                if (health.CurrentHealth != health.MaxHealth)
                {
                    base.Log.Debug("EvaluateTeamTank: not full health");
                    targetData.Priority += 2f;
                }
                TemperatureComponent temperature = targetTank.temperature;
                if (temperature.Temperature > 0f)
                {
                    base.Log.Debug("EvaluateTeamTank: positive temperature");
                    targetData.Priority += 5f;
                }
                else if (temperature.Temperature < 0f)
                {
                    base.Log.Debug("EvaluateTeamTank: negative temperature");
                    targetData.Priority += 4f;
                }
            }
        }
Example #17
0
        public Target FindNote(TargetData data)
        {
            int idx = BinarySearchOrderedNotes(data.beatTime);

            if (idx == -1)
            {
                Debug.LogError("Couldn't find note with time " + data.beatTime);
                return(null);
            }

            for (int i = idx; i < orderedNotes.Count; ++i)
            {
                Target t = orderedNotes[i];
                if (Mathf.Approximately(t.data.x, data.x) &&
                    Mathf.Approximately(t.data.y, data.y) &&
                    Mathf.Approximately(t.data.beatTime, data.beatTime) &&
                    t.data.handType == data.handType)
                {
                    return(t);
                }
            }

            Debug.LogError("Couldn't find note with time " + data.beatTime + " and index " + idx);
            return(null);
        }
Example #18
0
    void InitializeTargets(string longStringFromFile)
    {
        List <string> lines = new List <string>(
            longStringFromFile
            .Split(new string[] { "\r", "\n" },
                   System.StringSplitOptions.RemoveEmptyEntries));

        Debug.Log("Loading targets of length " + lines.Count + ": " + lines[0]);

        string[] header = lines[0].Split(',');
        versionLabel.text = string.Format("Game Version: {0}\nData Version: {1}", GAME_VERSION, header.Last());

        for (int i = 1; i < lines.Count; ++i)
        {
            string[]   split = lines[i].Split(',');
            TargetData data  = new TargetData();
            data.id              = split[0];
            data.name            = split[1];
            data.category        = split[2];
            data.responses       = split[3];
            data.disallowedWords = split[4];
            data.disallowedRegex = split[5];

            string maxCharacters = split[6];
            data.maxCharacters = string.IsNullOrEmpty(maxCharacters) ? MAX_CLUE_CHARACTERS : int.Parse(maxCharacters);
            targets.Add(data);
        }
    }
Example #19
0
    public void Setup(TestCase myTestCase)
    {
        _testCase           = myTestCase;
        TargetPrefab        = (_testCase.TargetMode == TargetMode.Framed ? FramedTargetPrefab : FramelessTargetPrefab);
        _itemCounter        = _testCase.TargetsCount;
        _colorRangeCategory = 0;
        _spacingGroup       = 0;
        _range = _testCase.MinTargetScale > _testCase.MaxTargetScale ?
                 new Vector2Int(_testCase.MaxTargetScale, _testCase.MinTargetScale) :
                 new Vector2Int(_testCase.MinTargetScale, _testCase.MaxTargetScale);
        _config.SetCameraProperties(_testCase.DisplayMode);
        _colorMode = _testCase.Color;
        if (_colorMode == ColorMode.Space)
        {
            _colorRangeCategory = _config.ColorRanges.Count - 1;
        }

        if (_testCase.DistanceMode == DistanceMode.LinRegOptimised)
        {
            _spacingGroup = 2;
        }
        GameObject target = Instantiate(TargetPrefab);

        target.transform.parent = this.transform;
        float   size     = _config.GetRandomScale(_range);
        Vector2 position = new Vector2(0, 0);
        Color   color    = _config.GetColor(_colorMode, _colorRangeCategory);

        _targetData = new TargetData(color, position[0], position[1], size, DateTime.Now, _config.ColorDiffBg(color));
        target.GetComponent <TargetController>().Construct(size, position, color);
    }
    public override List <Ilife> GetTargetList(Ilife thisUnit, TargetData data, FuncContext context)
    {
        List <Ilife> res = new List <Ilife>();

        if (thisUnit == null)
        {
            return(res);
        }
        Vector3 point    = ((ITransformBehaviour)(thisUnit)).GetTransformData().GetPosition();
        float   r        = ((ITransformBehaviour)(thisUnit)).GetTransformData().GetScale().x;
        var     lifeList = LifeManager.GetLifeList();

        foreach (var elem in lifeList)
        {
            if (elem.Key == thisUnit.GetInstanceId())
            {
                continue;
            }
            Ilife   otherLifes = elem.Value;
            Vector3 point1     = ((ITransformBehaviour)(otherLifes)).GetTransformData().GetPosition();
            if (Vector3.Distance(point, point1) < r)
            {
                // add to target list
                res.Add(otherLifes);
            }
        }
        return(res);
    }
Example #21
0
        public void Fasterflect_DelegateForMap()
        {
            using (new OperationTimer("Fasterflect DelegateForMap")) {
                var mapper = Fasterflect.MapExtensions.DelegateForMap(typeof(SourceData), typeof(TargetData));

                SourceDatas
                .AsParallel()
                .Run(source => {
                    var target = new TargetData();

                    mapper(source, target);

                    // Id 값은 수형이 달라, 매핑되지 않습니다. 그래서 명시적으로 수행해 주어야 합니다.
                    target.Id = source.Id;

                    Assert.AreEqual(source.Id, target.Id);
                    Assert.AreEqual(source.Name, target.Name);
                    Assert.AreEqual(source.Guid, target.Guid);
                    Assert.AreEqual(source.CreatedDate, target.CreatedDate);
                    Assert.AreEqual(source.ElapsedTimeSpan, target.ElapsedTimeSpan);
                    Assert.AreEqual(source.NumberLong.GetValueOrDefault(), (float)target.NumberLong.GetValueOrDefault());

                    Assert.AreNotEqual(source.DataOnly, target.OtherDataOnly);
                });
            }
        }
Example #22
0
    static void AddTwistChain(Twist.TwistChain twistChain)
    {
        if (!twistChain.HasValidData())
        {
            return;
        }

        GameDebug.Assert(s_SourceJoints.length < k_MaxSetups, "You are trying to add more twist joint chains then there is allocated space for.");
        GameDebug.Assert(s_TwistJoints.length + twistChain.twistJoints.Count <= k_MaxTwistJoints, "You are trying to add more twist joint then there is allocated space for.");

        s_SourceJoints.Add(twistChain.driver);
        s_SourceData[s_SetupIndex] = new SourceData
        {
            bindpose = twistChain.bindpose
        };

        for (var j = 0; j < twistChain.twistJoints.Count; j++)
        {
            if (twistChain.twistJoints[j].joint != null)
            {
                s_TwistJoints.Add(twistChain.twistJoints[j].joint);
                s_TargetData[s_TwistIndex] = new TargetData
                {
                    sourceIndex = s_SetupIndex,
                    twistFactor = twistChain.twistJoints[j].factor
                };
                s_TwistIndex++;
            }
        }

        s_SetupIndex++;
    }
 public NormalEnemy(TargetData tData)
 {
     /// ステータスの初期化
     _dispTime               = tData.dispTime;
     _banishTime             = tData.banishTime;
     this.transform.position = new Vector3(tData.pos.x, tData.pos.y, 0);
 }
Example #24
0
    public static TargetData[] LoadEnemies(int level)
    {
        string path = Application.persistentDataPath + "/" + level;

        string[]     dirs     = Directory.GetDirectories(path);
        TargetData[] toReturn = new TargetData[dirs.Length];
        for (int i = 0; i < dirs.Length; i++)
        {
            if (File.Exists(path))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                try
                {
                    FileStream stream = new FileStream(path, FileMode.Open);
                    TargetData data   = formatter.Deserialize(stream) as TargetData;
                    stream.Close();
                    toReturn[i] = data;
                }
                catch
                {
                    Debug.Log("Could not make stream");
                    break;
                }
            }
            else
            {
                Debug.Log("Save File not found in " + path);
                break;
            }
        }
        return(toReturn);
    }
Example #25
0
    public override IEnumerator Perform(TargetData targetData)
    {
        Vector3 start        = targetData.origin.transform.position;
        Vector3 shotPosition = targetData.origin.transform.position + (targetData.targets[0].transform.position - targetData.origin.transform.position) * 0.2f;

        Sequence sequence = DOTween.Sequence();

        sequence.Append(targetData.origin.transform.DOJump(shotPosition, 0.2f, 2, 1));
        sequence.AppendInterval(0.5f);
        sequence.Append(targetData.origin.transform.DOJump(start, 0.2f, 2, 1));

        yield return(waitASec);

        PlayAttackAnimation(targetData.origin);
        PlayAttackSound(targetData.origin);

        foreach (Character t in targetData.targets)
        {
            int damage = GetDamage(targetData.origin, t);
            t.transform.DOShakePosition(0.5f, new Vector3(0.1f, 0, 0), 20).SetDelay(0.1f);
            t.TakeDamage(damage);
            DisplayDamageText(t, damage);
            Instantiate(impactParticles, t.transform.position, Quaternion.identity);
        }

        yield return(waitASec);

        yield return(waitASec);
    }
Example #26
0
    public static TargetData LoadPlayer()
    {
        string path = Application.persistentDataPath + "/Player.fun";

        if (File.Exists(path))
        {
            BinaryFormatter formatter = new BinaryFormatter();
            try
            {
                FileStream stream = new FileStream(path, FileMode.Open);
                TargetData data   = formatter.Deserialize(stream) as TargetData;
                stream.Close();
                return(data);
            }
            catch
            {
                Debug.Log("Could not make stream");
                return(null);
            }
        }
        else
        {
            Debug.Log("Save File not found in " + path);
            return(null);
        }
    }
Example #27
0
    /// <summary>
    /// create Target Search
    /// </summary>
    /// <param name="p_Data"></param>
    /// <returns></returns>
    public static TargetSearch CreateTS(TargetData p_Data)
    {
        TargetSearch ts = tsFactory.Create(p_Data.type);

        ts.Deserialize(p_Data);
        return(ts);
    }
Example #28
0
    private void Awake()
    {
        truck           = GetComponent <Truck>();
        truck.TruckData = PlayerStaticRunTimeData.playerTruckData;
        truck.SetUpTruck();

        FirstTrackingGroupsTarget       = new TargetData(null, null);
        SecondTrackingGroupTarget       = new TargetData(null, null);
        TrackingGroupsTargetsDictionary = new Dictionary <GameEnums.TrackingGroup, TargetData>(2);
        TrackingGroupsTargetsDictionary.Add(GameEnums.TrackingGroup.FirstTrackingGroup, FirstTrackingGroupsTarget);
        TrackingGroupsTargetsDictionary.Add(GameEnums.TrackingGroup.SecondTrackingGroup, SecondTrackingGroupTarget);
        steeringForce      = 0;
        movingForce        = 0;
        backwardBoostValue = 10f;

        int playerFPType = (int)truck.TruckData.firePointType;
        int playerTruck  = (int)truck.TruckData.truckType;

        if (playerFPType == 0)
        {
            truck.trucksCondition.ResetCondition(30000 + (30000 * playerTruck / 10));
        }
        if (playerFPType == 1)
        {
            truck.trucksCondition.ResetCondition(45000 + (45000 * playerTruck / 10));
        }
        if (playerFPType == 3)
        {
            truck.trucksCondition.ResetCondition(75000 + (75000 * playerTruck / 10));
        }
        if (playerFPType == 7)
        {
            truck.trucksCondition.ResetCondition(105000 + (105000 * playerTruck / 10));
        }
    }
Example #29
0
        internal void TargetChanged()
        {
            EventTriggerStateChanged(EventTriggers.Tracking, Target.HasTarget);
            EventTriggerStateChanged(EventTriggers.StopTracking, !Target.HasTarget);

            if (!Target.HasTarget)
            {
                if (DrawingPower)
                {
                    Charging = false;
                    StopPowerDraw();
                }

                if (Comp.Session.MpActive && Comp.Session.IsServer)
                {
                    TargetData.ClearTarget();
                    if (!Comp.Data.Repo.Base.State.TrackingReticle)
                    {
                        Target.PushTargetToClient(this);
                    }
                }
            }

            Target.TargetChanged = false;
        }
Example #30
0
        public TargetData GetTargetInfo(string userId)
        {
            if (UserCache.TargetsByUser.Keys.Contains(userId))
            {
                return(UserCache.TargetsByUser[userId]);
            }

            TargetData target = new TargetData();
            User       user   = db.Users.FirstOrDefault(o => o.Id == userId);

            if (user == null)
            {
                return(null);
            }
            if (user.Roles.Count(o => o.Id == RoleCache.PayMentRoleId) == 0)
            {
                return(null);
            }
            if (user.Buildings.Count > 0)
            {
                target.Category = CategoryDictionary.Building;
                target.TargetId = user.Buildings.FirstOrDefault().Id;
                target.Name     = user.Buildings.FirstOrDefault().Name;
            }
            else
            {
                target.Category = CategoryDictionary.Organization;
                target.TargetId = user.Organizations.FirstOrDefault().Id;
                target.Name     = user.Organizations.FirstOrDefault().Name;
            }
            UserCache.TargetsByUser.Add(userId, target);
            return(target);
        }
Example #31
0
    private void Awake()
    {
        TargetData tData = Resources.Load <TargetData>("ScriptableObjects/TargetData");

        Assert.IsNotNull(tData, "ScriptableObject (TargetData) not found, have you moved the script away from \"Resources/ScriptableObjects/TargetData\"?");
        tData.friendlies.Add(gameObject);
    }
Example #32
0
File: CLR.cs Project: tytouf/cilc
    public static void Initialize(LLVM.Module module)
    {
        TargetData tgt = new TargetData("e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32");
          // TargetData tgt = new TargetData(module.DataLayout);

          Void = LLVM.Type.GetVoid();
          //module.AddTypeName("type System.Void", Void);
          Bool = LLVM.Type.GetInt8();
          //module.AddTypeName("type System.Bool", Bool);
          Char = LLVM.Type.GetInt8();
          //module.AddTypeName("type System.Char", Char);
          Int8 = LLVM.Type.GetInt8();
          //module.AddTypeName("type System.Int8", Int8);
          Int16 = LLVM.Type.GetInt16();
          //module.AddTypeName("type System.Int16", Int16);
          Int32 = LLVM.Type.GetInt32();
          //module.AddTypeName("type System.Int32", Int32);
          Int64 = LLVM.Type.GetInt64();
          //module.AddTypeName("type System.Int64", Int64);

          Native = tgt.GetIntPtrType();
          //module.AddTypeName("type System.Native", Native);

          Ptr = Native.GetPointerTo(0);
          //module.AddTypeName("type System.Ptr", Ptr);

          Object = LLVM.StructType.Get(module.Context, "type System.Object", new LLVM.Type[2] { Int32, Int32 }, false);
          //module.AddTypeName("type System.Object", Object);

          String = LLVM.Type.GetInt8(); // FIXME, TODO
          //module.AddTypeName("type System.String", String);

          // Initialize constants
          //
          Const_0 = GetConstant(0);
          Const_1 = GetConstant(1);
          Const_2 = GetConstant(2);
          Const_3 = GetConstant(3);
          Const_4 = GetConstant(4);
          Const_5 = GetConstant(5);
          Const_6 = GetConstant(6);
          Const_7 = GetConstant(7);
          Const_8 = GetConstant(8);
          Const_m1 = GetConstant(-1);

          LLVM.FunctionType ft = LLVM.FunctionType.Get(Object.GetPointerTo(0),
                                    new LLVM.Type[1] { Native }, false);
          Newobj = new LLVM.Function(module, "newobj", ft);

          ft = LLVM.FunctionType.Get(String.GetPointerTo(0),
                               new LLVM.Type[1] { Int8.GetPointerTo(0) }, false);
          Newstr = new LLVM.Function(module, "newstring", ft);

          ft = LLVM.FunctionType.Get(Object.GetPointerTo(0),
                                  new LLVM.Type[2] { Native, Native }, false);
          Newarr = new LLVM.Function(module, "newarr", ft);
    }
Example #33
0
        public void ObjectMap() {
            using(new OperationTimer("Object Map")) {
                foreach(var source in SourceDatas) {
                    var target = new TargetData();

                    ObjectMapper.Map(source, target, true, true, new[] { "OtherDataOnly" });

                    Assert.AreEqual(source.Id, target.Id, "Id가 매핑되지 않았습니다.");
                    Assert.AreEqual(source.Name, target.Name);
                    Assert.AreEqual(source.Guid, target.Guid);
                    Assert.AreEqual(source.CreatedDate, target.CreatedDate);
                    Assert.AreEqual(source.ElapsedTimeSpan, target.ElapsedTimeSpan);
                    Assert.AreEqual((decimal)source.NumberLong.GetValueOrDefault(), target.NumberLong.GetValueOrDefault());

                    Assert.AreNotEqual(source.DataOnly, target.OtherDataOnly);
                }
            }
        }
Example #34
0
	// Update is called once per frame
	void Update () {
        Vector3 prev_pos = transform.position;
        
        if (tm.current_turnholder != null)
            if (tm.current_turnholder.player)
                last_turnholder = tm.current_turnholder;

        uid.cs = null;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        var rh = Physics.RaycastAll(ray);
        rend.enabled = false;
        if (!UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
        {
            rend.material.color = new Color(1.0f, 1.0f, 1.0f);
            int rh_final = -1;
            for (int i = 0; i < rh.Length; ++i)
            {
                ClickScript other = rh[i].transform.GetComponentInParent<ClickScript>();
                if (other != null)
                {
                    rh_final = i;
                }
                else
                {
                    if (rh_final < 0)
                        rh_final = i;
                }
            }
            if (rh_final >= 0)
            {
                ClickScript other = rh[rh_final].transform.GetComponentInParent<ClickScript>();
                uid.cs = other;
                if (other != null)
                    uid.gameObject.SetActive(true);
                if (other != null)
                {
                    rend.material.color = new Color(1.0f, 0.0f, 0.0f);
                    if (last_turnholder != null)
					    if (other.team == last_turnholder.team)
						    rend.material.color = new Color(0.0f, 1.0f, 0.0f);
                    transform.position = other.transform.position;
                    transform.localScale = rh[rh_final].transform.localScale;
                }
                else
                {
                    Vector2 target = rh[rh_final].point;
                    target.x = Mathf.Round(target.x - 0.5f) + 0.5f;
                    target.y = Mathf.Round(target.y - 0.5f) + 0.5f;

                    transform.position = target;
                }
                rend.enabled = true;
            }
        }

        bool ce = !rend.enabled || tm.current_turnholder == null;
        if (tm.current_turnholder != null)
            ce |= !tm.current_turnholder.my_turn;
        if (pm != null && tm != null)
        {
            if (ce)
                pm.Clear();
            else
            {
                if (prev_pos != transform.position || rend.enabled && !pe)
                {
                    TargetData td = new TargetData();
                    td.start = new Vector2(tm.current_turnholder.transform.position.x, tm.current_turnholder.transform.position.y);
                    td.end = new Vector2(transform.position.x, transform.position.y);
                    td.searcher = tm.current_turnholder;
                    td.use_end = true;

                    tm.terrain.GetPath(td);

                    if (td.paths.Count > 0)
                        pm.Construct(td.paths[0], transform.position);
                    else
                        pm.Clear();
                }
            }
        }

        pe = ce;
    }
Example #35
0
        public void Fasterflect_MapProperties() {
            using(new OperationTimer("Fasterflect MapProperties")) {
                SourceDatas
                    .AsParallel()
                    .Run(source => {
                             var target = new TargetData();
                             source.MapProperties(target);

                             // Id 값은 수형이 달라, 매핑되지 않습니다. 그래서 명시적으로 수행해 주어야 합니다.
                             target.Id = source.Id;

                             Assert.AreEqual(source.Id, target.Id);
                             Assert.AreEqual(source.Name, target.Name);
                             Assert.AreEqual(source.Guid, target.Guid);
                             Assert.AreEqual(source.CreatedDate, target.CreatedDate);
                             Assert.AreEqual(source.ElapsedTimeSpan, target.ElapsedTimeSpan);
                             Assert.AreEqual(source.NumberLong.GetValueOrDefault(), (float)target.NumberLong.GetValueOrDefault());

                             Assert.AreNotEqual(source.DataOnly, target.OtherDataOnly);
                         });
            }
        }
Example #36
0
        public void Fasterflect_DelegateForMap() {
            using(new OperationTimer("Fasterflect DelegateForMap")) {
                var mapper = Fasterflect.MapExtensions.DelegateForMap(typeof(SourceData), typeof(TargetData));
                SourceDatas
                    .AsParallel()
                    .Run(source => {
                             var target = new TargetData();
                             mapper(source, target);

                             // Id 값은 수형이 달라, 매핑되지 않습니다. 그래서 명시적으로 수행해 주어야 합니다.
                             target.Id = source.Id;

                             Assert.AreEqual(source.Id, target.Id);
                             Assert.AreEqual(source.Name, target.Name);
                             Assert.AreEqual(source.Guid, target.Guid);
                             Assert.AreEqual(source.CreatedDate, target.CreatedDate);
                             Assert.AreEqual(source.ElapsedTimeSpan, target.ElapsedTimeSpan);
                             Assert.AreEqual(source.NumberLong.GetValueOrDefault(), (float)target.NumberLong.GetValueOrDefault());

                             Assert.AreNotEqual(source.DataOnly, target.OtherDataOnly);
                         });
            }
        }
 public abstract List<Ilife> GetTargetList(Ilife thisUnit, TargetData data, FuncContext context);
Example #38
0
    public void GetPath(TargetData td)
    {
        KeyValuePair<int, int> source = GetCellPosition(td.start);
        KeyValuePair<int, int> target = GetCellPosition(td.end);

        HashSet<KeyValuePair<int, int>> closed = new HashSet<KeyValuePair<int, int>>();
        HashSet<KeyValuePair<int, int>> open = new HashSet<KeyValuePair<int, int>>();
        open.Add(source);

        List<List<float>> g_score = new List<List<float>>();
        List<List<float>> f_score = new List<List<float>>();

        List<List<KeyValuePair<int, int>>> path = new List<List<KeyValuePair<int, int>>>();

        for (int x = 0; x < size.x; ++x)
        {
            g_score.Add(new List<float>());
            f_score.Add(new List<float>());
            path.Add(new List<KeyValuePair<int, int>>());
            for (int y = 0; y < size.y; ++y)
            {
                float gdist = float.PositiveInfinity;
                float fdist = float.PositiveInfinity;
                if (x == source.Key && y == source.Value)
                {
                    gdist = 0.0f;
                    fdist = Mathf.Sqrt((target.Key - source.Key) * (target.Key - source.Key) + (target.Value - source.Value) * (target.Value - source.Value));
                }
                g_score[x].Add(gdist);
                f_score[x].Add(fdist);
                path[x].Add(new KeyValuePair<int, int>(-1, -1));
            }
        }

        List<KeyValuePair<int, int>> nb = new List<KeyValuePair<int, int>>();
        nb.Add(new KeyValuePair<int, int>(1, 0));
        nb.Add(new KeyValuePair<int, int>(-1, 0));
        nb.Add(new KeyValuePair<int, int>(0, 1));
        nb.Add(new KeyValuePair<int, int>(0, -1));
        nb.Add(new KeyValuePair<int, int>(1, 1));
        nb.Add(new KeyValuePair<int, int>(-1, 1));
        nb.Add(new KeyValuePair<int, int>(1, -1));
        nb.Add(new KeyValuePair<int, int>(-1, -1));

        while (open.Count > 0)
        {
            KeyValuePair<int, int> current = new KeyValuePair<int, int>(-1, -1);
            float current_f = float.PositiveInfinity;
            List<KeyValuePair<int, int>> lowest = new List<KeyValuePair<int, int>>();
            foreach (KeyValuePair<int, int> node in open)
            {
                float fdist = f_score[node.Key][node.Value];
                if (fdist < current_f)
                {
                    current_f = fdist;
                    current = node;
                    lowest.Clear();
                    lowest.Add(node);
                }
                else
                {
                    if (fdist == current_f)
                    {
                        lowest.Add(node);
                    }
                }
            }
            if (td.random)
            {
                current = lowest[RandomManager.ai.Next(lowest.Count)];
            }

            open.Remove(current);
            closed.Add(current);

            bool finished = false;
            if (td.use_end)
                finished = current.Key == target.Key && current.Value == target.Value;
            else
            {
                GameObject go = grid[current.Key][current.Value];
                if (go != null)
                {
                    ClickScript cs = go.GetComponent<ClickScript>();
                    if (cs != null)
                        finished = cs.team != td.searcher.team;
                }
            }
            if (finished)
            {
                List<Vector2> total_path = new List<Vector2>();
                while (current.Key >= 0)
                {
                    total_path.Add(new Vector2(current.Key + 0.5f, current.Value + 0.5f) + origin);
                    current = path[current.Key][current.Value];
                }
                td.paths.Add(total_path);
                if (td.use_end)
                    return;
                continue;
            }

            for (int i=0;i<8;++i)
            {
                KeyValuePair<int, int> next = new KeyValuePair<int, int>(current.Key + nb[i].Key, current.Value + nb[i].Value);
                if (next.Key >= 0 && next.Key < size.x && next.Value >= 0 && next.Value < size.y && !closed.Contains(next))
                {
                    GameObject go = grid[next.Key][next.Value];
                    bool can_advance = go == null;
                    if (go != null)
                    {
                        if (td.use_end)
                            can_advance |= next.Value == target.Value && next.Key == target.Key;
                        else
                        {
                            ClickScript cs = go.GetComponent<ClickScript>();
                            if (cs != null)
                                can_advance |= cs.team != td.searcher.team && cs.hp.current > 0;
                        }
                    }
                    if (can_advance)
                    {
                        float gdist = g_score[current.Key][current.Value] + Mathf.Sqrt(nb[i].Key * nb[i].Key + nb[i].Value * nb[i].Value);
                        open.Add(next);
                        if (gdist < g_score[next.Key][next.Value])
                        {
                            path[next.Key][next.Value] = current;
                            g_score[next.Key][next.Value] = gdist;
                            f_score[next.Key][next.Value] = gdist + Mathf.Sqrt((target.Key - next.Key) * (target.Key - next.Key) + (target.Value - next.Value) * (target.Value - next.Value));
                        }
                    }
                }
            }
        }
    }
Example #39
0
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.I32) {
           Id = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.List) {
           {
             TargetDataList = new List<TargetData>();
             TList _list32 = iprot.ReadListBegin();
             for( int _i33 = 0; _i33 < _list32.Count; ++_i33)
             {
               TargetData _elem34 = new TargetData();
               _elem34 = new TargetData();
               _elem34.Read(iprot);
               TargetDataList.Add(_elem34);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
Example #40
0
 colonywebservices.azurewebsites.net.TargetData ToWebServiceClassTargetData(TargetData item)
 {
     return new colonywebservices.azurewebsites.net.TargetData
     {
         UserInfo = ToWebServiceClassInfomationOfUser(item.UserInfo),
         TargetDataId = item.TargetDataId,
         Mode = item.Mode,
         Tags = item.Tags,
         OccurrenceDataTime = item.OccurrenceDataTime,
         WhatAttribute = item.WhatAttribute,
         WhenAttribute = item.WhenAttribute,
         WhyAttribute = item.WhyAttribute,
         WhoAttribute = item.WhoAttribute,
         WhereAttribute = item.WhereAttribute,
         WhomAttribute = item.WhomAttribute,
         HowAttribute = item.HowAttribute,
         HowMuchAttribute = item.HowMuchAttribute,
         HowManyAttribute = item.HowManyAttribute
     };
 }
 public override List<Ilife> GetTargetList(Ilife thisUnit, TargetData data, FuncContext context)
 {
     return null;
 }