Beispiel #1
0
 void OnEnable()
 {
     if (player == null)
     {
         player = GameObject.FindWithTag("Player") ? GameObject.FindWithTag("Player").GetComponent <PlayerOwner>() : null;
     }
 }
Beispiel #2
0
            internal void Upgrade()
            {
                if (Owner is Player PlayerOwner)
                {
                    PlayerOwner.TransferMoney(GameBoard.BANK, UpgradeCost);
                    if (PlayerOwner.IsPlayering)
                    {
                        PlayerOwner.RaiseEventHouseUpgrade(this);
                        UpgradeLevel += 1;
                    }

                    if (this.Cost > GameBoard.Statistics.MaxCost)
                    {
                        GameBoard.Statistics.MaxCost = this.Cost;
                    }
                    if (this.Rent > GameBoard.Statistics.MaxRent)
                    {
                        GameBoard.Statistics.MaxRent = this.Rent;
                    }
                    if (this.UpgradeLevel > GameBoard.Statistics.MaxUpgradeLevel)
                    {
                        GameBoard.Statistics.MaxUpgradeLevel = this.UpgradeLevel;
                    }
                }
            }
Beispiel #3
0
 public PlayerSetting(int?startPosition, string side, ColorRgb color, PlayerOwner owner = PlayerOwner.None, string name = "")
 {
     StartPosition = startPosition;
     Side          = side;
     Color         = color;
     Owner         = owner;
     Name          = name;
 }
Beispiel #4
0
 public PlayerSetting(int?startPosition, PlayerTemplate template, ColorRgb color, PlayerOwner owner = PlayerOwner.None, string name = "")
 {
     StartPosition = startPosition;
     Template      = template;
     Color         = color;
     Owner         = owner;
     Name          = name;
 }
Beispiel #5
0
 public PlayerSetting(int?startPosition, string sideName, ColorRgb color, int team, PlayerOwner owner = PlayerOwner.None, string name = "", bool isLocalForMultiplayer = false)
 {
     StartPosition         = startPosition;
     SideName              = sideName;
     Color                 = color;
     Owner                 = owner;
     Name                  = name;
     Team                  = team;
     IsLocalForMultiplayer = isLocalForMultiplayer;
 }
 public Color GetColorByOwner(PlayerOwner owner)
 {
     for (int i = 0; i < _colorsCollection.Length; i++)
     {
         var colordata = _colorsCollection[i];
         if (colordata.PlayerOwner == owner)
         {
             return(colordata.Color);
         }
     }
     Debug.LogError($"There is no colors for owner {owner}!");
     return(Color.black);
 }
Beispiel #7
0
    void Awake()
    {
        if (!slotPrefab || !content || !currencyText)
        {
            Debug.LogError("InventoryUI: Variables have not been set.");
            Destroy(this);
        }

        player     = GameObject.FindWithTag("Player") ? GameObject.FindWithTag("Player").GetComponent <PlayerOwner>() : null;
        scrollView = (RectTransform)content.parent.parent ?? null;

        CreateGrid();
    }
Beispiel #8
0
    void Update()
    {
        foreach (char c in Input.inputString)
        {
            if (c == '\b')
            {
                if (isEnabled && input.Length != 0)
                {
                    input = input.Substring(0, input.Length - 1);
                }
            }
            else if (c == '\n' || c == '\r')
            {
                if (isEnabled)
                {
                    PlayerOwner playerOwner = uLink.Network.player.localData as PlayerOwner;
                    if (playerOwner != null)
                    {
                        networkView.RPC("Chat", uLink.RPCMode.Server, playerOwner.playerName + ": " + input, playerOwner.playerColor);
                    }
                    input = "";
                }

                isEnabled = !isEnabled;
            }
            else if (isEnabled)
            {
                input += c;
            }
        }

        if (!uLink.Network.isClient || uLink.Network.player.localData == null)
        {
            isEnabled = false;
        }

        GetComponent <GUIText>().enabled = isEnabled;
        GetComponent <GUIText>().text    = prefix + input + (showCursor ? cursor : "");
    }
 public override void OnEndDrag()
 {
     // 1) Check if we are holding a card over the table
     if (DragSuccessful())
     {
         // determine table position
         int tablePos = PlayerOwner.PArea.tableVisual.TablePosForNewCreature(Camera.main.ScreenToWorldPoint(
                                                                                 new Vector3(Input.mousePosition.x, Input.mousePosition.y, transform.position.z - Camera.main.transform.position.z)).x);
         // Debug.Log("Table Pos for new Creature: " + tablePos.ToString());
         // play this card
         PlayerOwner.PlayACreatureFromHand(GetComponent <IDHolder>().uniqueID, tablePos);
     }
     else
     {
         // Set old sorting order
         whereIsCard.SetHandSortingOrder();
         whereIsCard.VisualState = tempState;
         // Move this card back to its slot position
         HandVisual PlayerHand = PlayerOwner.PArea.handVisual;
         Vector3    oldCardPos = PlayerHand.slots.Children[savedHandSlot].transform.localPosition;
         transform.DOLocalMove(oldCardPos, 1f);
     }
 }
    public override void OnEndDrag()
    {
        RaycastHit[] hits;
        // TODO: raycast here anyway, store the results in
        hits = Physics.RaycastAll(origin: Camera.main.transform.position,
                                  direction: (-Camera.main.transform.position + this.transform.position).normalized,
                                  maxDistance: 30f);
        foreach (RaycastHit h in hits)
        {
            //Debug.Log(h, h.transform);
            if (h.transform.tag.Contains("Full Table") && h.transform.GetComponent <FullTableVisual>().IsValidTarget)
            {
                // hit the full table
                DebugManager.Instance.DebugMessage("You've selected the entire table.", DebugManager.MessageType.Targeting);
                PlayerOwner.PlayASpellFromHand(GetComponent <IDHolder>().uniqueID, -1);
                return;
            }
        }

        DebugManager.Instance.DebugMessage("Failed to find target.", DebugManager.MessageType.PlayerInteraction);
        // Set old sorting order
        whereIsCard.Slot = savedHandSlot;
        if (tag.Contains("Bottom"))
        {
            whereIsCard.VisualState = VisualStates.BottomHand;
        }
        else
        {
            whereIsCard.VisualState = VisualStates.TopHand;
        }
        // Move this card back to its slot position
        HandVisual PlayerHand = PlayerOwner.PArea.handVisual;
        Vector3    oldCardPos = PlayerHand.slots.Children[savedHandSlot].transform.localPosition;

        transform.DOLocalMove(oldCardPos, 1f);
    }
Beispiel #11
0
        protected override void TickCore(Pet host, RealmTime time, ref object state)
        {
            var cool = (int)state;

            if (cool <= 0)
            {
                var maxHp = PlayerOwner.Stats[1];
                var mp    = LinearGrowthMagicHeal();
                cool = DiminishingReturnsCooldown(1, 10, Ability.Level, 0.5264);
                if (mp == -1)
                {
                    return;
                }
                var newHp = Math.Min(maxHp, PlayerOwner.MP + mp);
                if (newHp != PlayerOwner.MP)
                {
                    if (PlayerOwner.HasConditionEffect(ConditionEffects.Quiet))
                    {
                        PlayerOwner.Owner.BroadcastPacket(new ShowEffect
                        {
                            EffectType     = EffectType.Trail,
                            TargetObjectId = host.Id,
                            Pos1           = new Position {
                                X = PlayerOwner.X, Y = PlayerOwner.Y
                            },
                            Color = new ARGB(0xffffffff)
                        }, null);
                        PlayerOwner.Owner.BroadcastPacket(new Notification
                        {
                            ObjectId = PlayerOwner.Id,
                            Message  = "{\"key\":\"blank\",\"tokens\":{\"data\":\"No Effect\"}}",
                            Color    = new ARGB(0xFF0000)
                        }, null);
                        state = cool;
                        return;
                    }
                    var n = newHp - PlayerOwner.MP;
                    PlayerOwner.MP = newHp;
                    PlayerOwner.Owner.BroadcastPacket(new ShowEffect
                    {
                        EffectType     = EffectType.Potion,
                        TargetObjectId = PlayerOwner.Id,
                        Color          = new ARGB(0x6084e0)
                    }, null);
                    PlayerOwner.Owner.BroadcastPacket(new ShowEffect
                    {
                        EffectType     = EffectType.Trail,
                        TargetObjectId = host.Id,
                        Pos1           = new Position {
                            X = PlayerOwner.X, Y = PlayerOwner.Y
                        },
                        Color = new ARGB(0xffffffff)
                    }, null);
                    PlayerOwner.Owner.BroadcastPacket(new Notification
                    {
                        ObjectId = PlayerOwner.Id,
                        Message  = "{\"key\":\"blank\",\"tokens\":{\"data\":\"+" + n + "\"}}",
                        Color    = new ARGB(0x6084e0)
                    }, null);
                }
            }
            else
            {
                cool -= time.ElaspedMsDelta;
            }

            state = cool;
        }
Beispiel #12
0
    void Explode()
    {
        explFX = PhotonNetwork.Instantiate("GurungMiniNadeExplosionFX", transform.position, transform.rotation, 0);

        Collider [] colliders = Physics.OverlapSphere(transform.position, blastRadius);

        foreach (Collider nearbyObject in colliders)
        {
            Rigidbody rb = nearbyObject.GetComponent <Rigidbody> ();
            if (rb != null)
            {
                rb.AddExplosionForce(blastForce, explFX.transform.position, blastRadius);
            }
            if (nearbyObject.gameObject.GetComponent <TCP_CharactersHealth> () != null &&
                nearbyObject.gameObject.GetComponent <PhotonView>().owner.GetTeam() != PlayerOwner.GetTeam())
            {
                nearbyObject.gameObject.GetComponent <PhotonView>().RPC("ChangeHealth", PhotonTargets.AllBuffered, damage, false, PlayerOwner.ID);
            }
        }
        Invoke("DestroyMe", 1f);
    }
Beispiel #13
0
 public PlayerSetting(string side, ColorRgb color, PlayerOwner owner = PlayerOwner.None)
 {
     Side  = side;
     Color = color;
     Owner = owner;
 }
Beispiel #14
0
 void Awake()
 {
     orgLocalPos = transform.localPosition;
     player      = GameObject.FindWithTag("Player") ? GameObject.FindWithTag("Player").GetComponent <PlayerOwner>() : null;
 }
Beispiel #15
0
 public void SetOwner(PlayerOwner owner)
 {
     CurrentOwner = owner;
 }