コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        inp = GetComponent <InputHandler>();
        gm  = FindObjectOfType <GameManager>();
        st  = GetComponent <StatHandler>();

        if (isServer)
        {
            st.initialize();
            if (!gm.registerTeam(netId, out teamIndex))
            {
                Debug.LogError("Registraion error");
            }
            else
            {
                //initDeck();
                RpcAssignTeam(teamIndex);
            }
        }
        if (!isServer)
        {
            alignDir();
        }
        if (isLocalPlayer)
        {
            Instantiate(cameraPre, transform);
            StatHandler.Refresh reUI = FindObjectOfType <ResourceUI>().refresh;
            st.addRefresh(reUI);
            inspect   = FindObjectOfType <CardInspector>();
            UIturn    = FindObjectOfType <TurnIndicatorUI>();
            abilPanel = FindObjectOfType <UnitAbilityUI>();
            findClientDeck();
            //Debug.Log("Refresh added");
        }
    }
コード例 #2
0
    public void Init(StatHandler statHandler, VesselAudioSystem audioSystem)
    {
        this.statHandler = statHandler;
        this.audioSystem = audioSystem;

        healthUpdater = this.GetComponent <IHealthUpdate>();
    }
コード例 #3
0
ファイル: Stats.xaml.cs プロジェクト: Adek2kk/IntervalAppGit
        private void AllLogs()
        {
            // _QueryCollection.Clear();
            _QueryCollection.Clear();
            _SelectedQueryCollection.Clear();

            DataSet queries = StatHandler.getStats(Application.Current.Resources["ProjectPrefix"].ToString());

            //wywala sie jak nic nie ma
            try
            {
                foreach (DataRow row in queries.Tables["result"].Rows)
                {
                    _QueryCollection.Add(new StatHolder
                    {
                        id_query = Convert.ToInt32(row[0].ToString()),
                        sql      = row[1].ToString(),
                        time     = Convert.ToInt64(row[3].ToString()),
                        comment  = row[2].ToString()
                    });
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #4
0
    void Update()
    {
        //Debug.Log(hovered);
        if (hovered)
        {
            currentTime += Time.deltaTime;

            if (currentTime > GameConstants.hoverInspectTime)
            {
                currentTime = GameConstants.hoverInspectTime;
                if (!inspecting)
                {
                    StatHandler blk = mkr.GetComponent <StatHandler>();
                    controller.cardInspect(mkr.gameObject, blk ? blk.prefabStats() : null);
                    inspecting = true;
                }
            }
        }
        else
        {
            currentTime = 0;

            if (inspecting)
            {
                controller.cardUnInspect(mkr.gameObject);
                inspecting = false;
            }
        }
    }
コード例 #5
0
 public void addUpstream(StatHandler up)
 {
     Upstream.Add(up);
     up._addDownstream(this);
     modifyStatsStream(up.stats);
     //refreshDownstream();
 }
コード例 #6
0
ファイル: HUDMenu.cs プロジェクト: justi1jc/FPS
    void RenderAlive()
    {
        Actor actor = manager.actor;

        if (actor == null || actor.stats == null)
        {
            return;
        }
        StatHandler stats = actor.stats;
        // Display Condition bars
        int    ih = Height() / 20;
        int    iw = Width() / 3;
        int    x, y;
        string str = "";

        float current = (float)stats.health;
        float max     = (float)stats.healthMax;

        x   = XOffset();
        y   = 17 * ih;
        str = "" + stats.health + "/" + stats.healthMax;
        ProgressBar(current, max, (float)x, (float)y, Color.red, str);

        current = (float)stats.stamina;
        max     = (float)stats.staminaMax;
        y       = 18 * ih;
        str     = "" + stats.stamina + "/" + stats.staminaMax;
        ProgressBar(current, max, (float)x, (float)y, Color.green, str);

        current = (float)stats.mana;
        max     = (float)stats.manaMax;
        y       = 19 * ih;
        str     = "" + stats.mana + "/" + stats.manaMax;
        ProgressBar(current, max, (float)x, (float)y, Color.blue, str);

        RenderReticle();

        // Display Item info
        str = actor.ItemInfo();
        Box(str, XOffset() + 2 * iw, 18 * ih, iw, 2 * ih);

        // Display item in reach, if it exists.
        if (actor.itemInReach)
        {
            Item inReach = manager.actor.itemInReach.GetComponent <Item>();
            x = XOffset() + iw;
            y = 19 * ih;
            if (inReach.displayName != "")
            {
                Box(inReach.displayName, x, y, iw, ih);
            }
        }
        else if (actor.actorInReach)
        {
            str = actor.ActorInteractionText();
            x   = XOffset() + iw;
            y   = 19 * ih;
            Box(str, x, y, iw, ih);
        }
    }
コード例 #7
0
        public async Task PlayerStats(CommandContext ctx, string platform, [RemainingText] string username)
        {
            await ctx.TriggerTypingAsync();

            string result;

            try
            {
                result = await _httpclient.GetStringAsync($"https://api.mozambiquehe.re/bridge?version=5&platform={platform}&player={username}&auth={_configuration.ApiTrackerKey}");
            }
            catch (Exception)
            {
                await ctx.Channel.SendErrorAsync($"An error occured", "Couldn't fetch user data");

                return;
            }

            var stats  = StatHandler.GetPlayerStats(result);
            var embeds = StatHandler.BuildStatEmbeds(stats);

            var statEmbed = embeds[0];
            var rankEmbed = embeds[1];

            await ctx.RespondAsync(statEmbed);

            await ctx.RespondAsync(rankEmbed);
        }
コード例 #8
0
ファイル: UnitCardUI.cs プロジェクト: RZNewman/Conflict
    public override void populateSelf(Cardmaker maker, bool isPrefab)
    {
        Unit u = maker.GetComponent <Unit>();

        //
        if (u.cardArt != null)
        {
            populateArt(u.cardArt);
        }
        else
        {
            populateArt(maker.gameObject);
        }

        if (isPrefab)
        {
            StatHandler st = maker.GetComponent <StatHandler>();
            Dictionary <StatType, float> sts = st.prefabStats();
            populateTitle(maker.name);
            populateValues(sts);
            populateBody(sts, true, u.abilitiesPre.Select(x => x.GetComponent <Ability>()).ToArray());
        }
        else
        {
            populateTitle(maker.originalName);
            populateValues(u);
            populateBody(u.stat.export(), true, u.abilities.Select(x => x.GetComponent <Ability>()).ToArray());
        }

        populateType(u);
        populateCost(maker.resourceCost.ToString());
        modifyForStructure(u.isStructure);
    }
コード例 #9
0
 private void Start()
 {
     mySH            = GameObject.FindGameObjectWithTag("StatHandler").GetComponent <StatHandler>();
     myMS            = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementStats>();
     myDisplayChoice = Random.Range(0, 5);
     myDisplay.color = new Color(myDisplay.color.r, myDisplay.color.g, myDisplay.color.b, 0f);
 }
コード例 #10
0
 override protected void Awake()
 {
     base.Awake();
     _buffHandler = GameObject.FindGameObjectWithTag("Player").GetComponent <BuffHandler>();
     _statHandler = GameObject.FindGameObjectWithTag("Player").GetComponent <StatHandler>();
     UpdateSprite(AbilityUtil.GetAbilityHUDElement(ElementEnum.heal).Sprite);
 }
コード例 #11
0
    void OnTriggerEnter(Collider other)
    {
        /*   Debug.Log("Hit" + other.gameObject.name);
         * if (other.gameObject.layer != LayerMask.NameToLayer("Player"))
         * {
         *    other.gameObject.GetComponent<Rigidbody>().AddForce((other.transform.position - transform.position).normalized * SwordForceMultiplier);
         * }*/

        // Damage if enemy
        if (other.gameObject.layer == LayerMask.NameToLayer("Enemy"))
        {
            other.gameObject.transform.position += (other.gameObject.transform.position - transform.parent.position).normalized * SwordForceEnemyMultiplier;
            StatHandler sh = other.gameObject.GetComponent <StatHandler>();
            if (sh != null)
            {
                sh.TakeDamage(damage);
            }
            else
            {
                // Debug.Log("F");
            }

            // Debug.Log("Damage" + other.gameObject.name);
        }
    }
コード例 #12
0
ファイル: EquipCardUI.cs プロジェクト: RZNewman/Conflict
    public override void populateSelf(Cardmaker maker, bool isPrefab)
    {
        Equipment e = maker.GetComponent <Equipment>();

        //
        if (e.cardArt != null)
        {
            populateArt(e.cardArt);
        }
        else
        {
            populateArt(maker.gameObject);
        }

        if (isPrefab)
        {
            StatHandler st = maker.GetComponent <StatHandler>();
            Dictionary <StatType, float> sts = st.prefabStats();
            populateTitle(maker.name);

            populateBody(sts, false, maker.GetComponent <Buff>().abilitiesPre.Select(x => x.GetComponent <Ability>()).ToArray());
        }
        else
        {
            populateTitle(maker.originalName);
            populateBody(e.GetComponent <StatHandler>().export(), false, e.GetComponent <Buff>().abilities.Select(x => x.GetComponent <Ability>()).ToArray());
        }


        setBackground();
        populateType(e);


        populateCost(maker.resourceCost.ToString());
    }
コード例 #13
0
    // Start is called before the first frame update
    public void Init(StatHandler statHandler, SceneController sceneController)
    {
        this.actorStats = statHandler;

        hudManager = sceneController.dynamicHud;
        hudManager.healthBar.Init(actorStats.MaxHealth);
    }
コード例 #14
0
ファイル: ResourceUI.cs プロジェクト: RZNewman/Conflict
    // Update is called once per frame
    public void refresh()
    {
        //Debug.Log("Refresh called");
        assignGM();
        if (!gm)
        {
            return;
        }
        if (!gm.clientPlayer)
        {
            return;
        }
        StatHandler st = gm.clientPlayer.GetComponent <StatHandler>();

        if (income)
        {
            income.text = st.getStat(StatBlock.StatType.resourceIncome).ToString();
        }
        if (current)
        {
            current.text = gm.clientPlayer.getCurrentResources().ToString();
        }
        if (max)
        {
            max.text = st.getStat(StatBlock.StatType.resourceMax).ToString();
        }
        if (limit)
        {
            limit.text = st.getStat(StatBlock.StatType.resourceSpend).ToString();
        }
        if (cardCount)
        {
            cardCount.text = gm.clientPlayer.getCurrentCards().ToString();
        }
    }
コード例 #15
0
ファイル: Sword.cs プロジェクト: DanielCantz/Dawntown
    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("Sword Hit!\nDamage: " + damage + ". slowAmount: " + slowAmount + ". duration: " + duration + ". element: " + element + ".\nTag: " + other.tag);

        if (other.CompareTag("Player"))
        {
            BuffHandler playerBuffHandler = other.GetComponent <BuffHandler>();
            StatHandler statHandler       = other.GetComponent <StatHandler>();
            Buff        debuff;

            switch (element)
            {
            case ElementEnum.fire:

                debuff = new Burn(statHandler, new Stat(duration), damage);
                playerBuffHandler.AddBuff(debuff);
                break;

            case ElementEnum.ice:
                debuff = new Slow(statHandler, new Stat(duration), new ScalingStatModificator(slowAmount));
                statHandler.TakeDamage(damage);
                playerBuffHandler.AddBuff(debuff);
                break;

            case ElementEnum.lightning:
                debuff = new Stun(statHandler, new Stat(duration));
                statHandler.TakeDamage(damage);
                playerBuffHandler.AddBuff(debuff);
                break;
            }
        }
    }
コード例 #16
0
    private void Start()
    {
        thisText = GetComponent <Text>();
        mySH     = GameObject.FindGameObjectWithTag("StatHandler").GetComponent <StatHandler>();
        day      = mySH.dayNumber;

        thisText.text = whichDayIsIt[day];
    }
コード例 #17
0
 public void Init(StatHandler statHandler, List <IWeaponItem> weaponItems, VesselShipStats stats, WeaponInfo weaponInfo)
 {
     this.statHandler = statHandler;
     this.weaponItems = weaponItems;
     this.shipStats   = stats;
     this.weaponInfo  = weaponInfo;
     this.fireRate    = weaponInfo.weaponData.fireRate;
 }
コード例 #18
0
 /* Before Start */
 void Awake()
 {
     body = gameObject;
     inventory = new Inventory();
     arms = new EquipSlot(offHand, hand, this);
     doll = new PaperDoll(this);
     arms.actor = this;
     stats = new StatHandler(this);
 }
コード例 #19
0
 public Player(Texture2D playerTexture)
 {
     _spriteSheet = new SpriteSheet(playerTexture, 3, 4, 32, 32);
     _stats = new StatHandler();
     _stats.AddStat(new Strength(100), "Strength");
     _stats.AddStat(new Defence(100), "Defence");
     _stats.AddStat(new Health(100), "Health");
     _combatHandler = new DefaultCombatHandler();
 }
コード例 #20
0
        private void StopCaptureCmdExecute()
        {
            if (cts != null)
            {
                cts.Cancel();
            }

            StatHandler.Stop();
        }
コード例 #21
0
ファイル: Npc.cs プロジェクト: JohnLamontagne/dominus-engine
 public Npc(string uniqueID)
 {
     _uniqueID = uniqueID;
     _stats = new StatHandler();
     _stats.AddStat(new Strength(100), "Strength");
     _stats.AddStat(new Defence(100), "Defence");
     _stats.AddStat(new Health(100), "Health");
     _combatHandler = new DefaultCombatHandler();
 }
コード例 #22
0
ファイル: Tester.cs プロジェクト: DanielCantz/Dawntown
    private void TestUnitHasHealth()
    {
        StatHandler health = GetComponent <StatHandler>();

        if (health == null)
        {
            return;
        }
        health.TakeDamage(10);
    }
コード例 #23
0
ファイル: DamageBlock.cs プロジェクト: DanielCantz/Dawntown
    private void OnTriggerEnter(Collider other)
    {
        //Debug.Log("Enter");
        StatHandler otherStats = other.GetComponent <StatHandler>();

        if (otherStats)
        {
            otherStats.TakeDamage(10f);
            Debug.Log(otherStats.Health);
        }
    }
コード例 #24
0
    public void initailize(Unit u)
    {
        StatHandler bStats = GetComponent <StatHandler>();

        bStats.initialize();

        foreach (GameObject o in abilitiesPre)
        {
            abilities.Add(u.createAbility(o));
        }
    }
コード例 #25
0
 private void OnParticleCollision(GameObject other)
 {
     Debug.Log("Partilce hit");
     if (other.gameObject.CompareTag("Player"))
     {
         Debug.Log("Partilce hit player");
         StatHandler playerStatHandler = other.GetComponent <StatHandler>();
         Slow        slow = new Slow(playerStatHandler, new Stat(duration), new ScalingStatModificator(slowAmount));
         other.GetComponent <BuffHandler>().AddBuff(slow);
     }
 }
コード例 #26
0
ファイル: Stats.xaml.cs プロジェクト: Adek2kk/IntervalAppGit
        private void BtnDeleteSelected_Click(object sender, RoutedEventArgs e)
        {
            string ids = "";

            foreach (StatHolder row in _SelectedQueryCollection)
            {
                ids = ids + "'" + row.id_query + "',";
            }
            ids = ids.Remove(ids.Length - 1);
            StatHandler.deleteStats(ids);
            AllLogs();
        }
コード例 #27
0
ファイル: GameManager.cs プロジェクト: RZNewman/Conflict
    public void teamUnitUpstreamStats(StatHandler st, int team)
    {
        foreach (uint playerID in teams.Keys)
        {
            if (teams[playerID] == team)
            {
                StatHandler handler = NetworkIdentity.spawned[playerID].GetComponent <StatHandler>();

                handler.addUpstream(st);
            }
        }
    }
コード例 #28
0
 virtual protected void Start()
 {
     if (_playerHealthBar)
     {
         _statHandler = GameObject.FindGameObjectWithTag("Player").GetComponent <StatHandler>();
     }
     _slider     = GetComponent <Slider>();
     _fill.color = _color;
     if (_elementIcon != null)
     {
         _elementIcon.sprite = AbilityUtil.GetAbilityHUDElement(_statHandler.Element).Sprite;
     }
 }
コード例 #29
0
 void OnCollisionEnter(Collision other)
 {
     Debug.Log("Something fell out of the map");
     if (other.gameObject.CompareTag("Player"))
     {
         StatHandler statHandler = other.gameObject.GetComponent <StatHandler>();
         statHandler.TakeDamage(9999);
     }
     else
     {
         GameObject.Destroy(other.gameObject);
     }
 }
コード例 #30
0
ファイル: Tester.cs プロジェクト: DanielCantz/Dawntown
    private void TestBuffHandler()
    {
        StatHandler statHandler = GetComponent <StatHandler>();
        BuffHandler buffHandler = GetComponent <BuffHandler>();

        if (buffHandler == null)
        {
            return;
        }
        buffHandler.AddBuff(new Burn(statHandler, new Stat(5), 10));
        Debug.Log("Burned!");
        buffHandler.AddBuff(new Slow(statHandler, new Stat(5), new ScalingStatModificator(0.5f)));
        Debug.Log("Slowed!");
    }
コード例 #31
0
        public override void Init(SpawnManager spawner, TeamColor teamColor)
        {
            base.Init(spawner, teamColor);

            GameManager     gameManager     = GameManager.Instance;
            SceneController sceneController = gameManager.sceneController;

            if (playerState == null)
            {
                playerState = this.gameObject.AddComponent <PlayerStateManager>();
            }
            audioSystem = this.GetComponent <VesselAudioSystem>();
            audioSystem.Init(EntityType.Player);
            audioSystem.PlayFlightAudio(vesselSelection);
            PlayerSettings playerSettings = gameManager.gameSettings.playerSettings;

            //Initialise Stat Handler
            GameSettings    gameSettings = gameManager.gameSettings;
            VesselShipStats vesselStats  = gameSettings.vesselStats.Where(x => x.type == vesselSelection).First();
            BaseStats       playerStats  = vesselStats.baseShipStats;

            statHandler = new StatHandler(playerStats, EntityType.Player, this);

            //Initialize Health Component
            HealthComponent healthComponent = this.GetComponent <HealthComponent>();

            healthComponent.Init(statHandler, sceneController);

            //Initialise Weapon System
            IWeaponSystem weaponSystem = this.GetComponent <IWeaponSystem>();

            weaponSystem.Init(GetObjectID(), this, false, vesselStats, sceneController);

            //Initializes the player's camera system
            cameraController = this.GetComponent <CameraController>();
            cameraController.Init(virtualCamera, vesselSelection);

            //Load weapon/damage components.
            FighterDamageManager damageManager = this.GetComponent <FighterDamageManager>();

            damageManager.Init(statHandler, audioSystem);

            //Load Movement Manager
            MovementRegister movementRegister = this.GetComponent <MovementRegister>();

            Debug.Log(movementRegister);
            movementRegister.Init(this, cameraController);

            SetInitalState();
        }
コード例 #32
0
        private void StartCaptureCmdExecute()
        {
            if (packetReceiveThread != null)
            {
                packetReceiveThread.Abort();
                packetReceiveThread = null;
            }

            Packets.Clear();
            packetReceiveThread          = new Thread(new ThreadStart(PacketHandler));
            packetReceiveThread.Priority = ThreadPriority.AboveNormal;
            packetReceiveThread.Start();
            StatHandler.Start();
        }