Example #1
0
    public void AddResource(int value)
    {
        currentValue += value;

        if (currentValue > maximumValue && maximumValue > 0)
        {
            currentValue = maximumValue;
        }

        //if (currentValue < maximumValue) {
        //    currentValue += value;
        //}

        //Debug.Log(resourceType.ToString() + " is being increased in game resource");

        UpdateText();

        EventData data = new EventData();

        data.AddInt("ResourceType", (int)resourceType);
        data.AddInt("Value", value);
        data.AddMonoBehaviour("Player", manager.owner);

        Grid.EventManager.SendEvent(Constants.GameEvent.ResourceChanged, data);
    }
Example #2
0
    public void SetupResources(int textID, bool firstResource, int resourceTypeEnum, int current, int max, string name, int cap)
    {
        GameResource.ResourceType type = (GameResource.ResourceType)resourceTypeEnum;


        //Debug.Log(textID + " is the view id Sent");

        GameObject newTextGO = HUDRegistrar.FindHudElementByID(textID);

        if (newTextGO == null)
        {
            GameObject[] allHUD = GameObject.FindGameObjectsWithTag("HUD");

            foreach (GameObject go in allHUD)
            {
                if (go.GetPhotonView().viewID == textID)
                {
                    newTextGO = go;
                    break;
                }
            }
        }

        //Debug.Log(newTextGO);

        Text newText = newTextGO.GetComponent <Text>();

        if (firstResource)
        {
            GameResource essence = new GameResource(GameResource.ResourceType.Essence, 1, 1, "Essence", gameResourceDisplay, 10);

            gameResources.Add(essence);

            gameResourceDisplay.Initialize(this, essence, newText);
        }
        else
        {
            GameResource newResource = new GameResource(type, current, max, name, gameResourceDisplay, cap);

            gameResources.Add(newResource);

            gameResourceDisplay.AddNewResource(newResource, newText, false);



            EventData data = new EventData();
            data.AddInt("ResourceType", (int)type);
            data.AddInt("Value", current);
            data.AddMonoBehaviour("Player", this);

            Grid.EventManager.SendEvent(Constants.GameEvent.ResourceChanged, data);
        }
    }
    private void SendHitBoxEvent()
    {
        EventData data = new EventData();

        data.AddString("AttackName", stateName);
        //data.AddMonoBehaviour("Entity", owner);
        data.AddInt("ID", owner.SessionID);

        if (CurrentAbility != null)
        {
            data.AddInt("AbilityID", CurrentAbility.SessionID);
        }

        //Debug.Log(owner.entityName + " " + owner.SessionID + " is sending an animation event");

        SystemGrid.EventManager.SendEvent(Constants.GameEvent.AnimationEvent, data);
    }
Example #4
0
    private void SendEffectAppliedEvent(Entity target)
    {
        EventData data = new EventData();

        data.AddMonoBehaviour("Cause", Source);
        data.AddMonoBehaviour("Target", target);
        data.AddInt("EffectType", (int)effectType);

        EventGrid.EventManager.SendEvent(Constants.GameEvent.EffectApplied, data);
    }
Example #5
0
    public void RemoveItem(Item item)
    {
        if (items.RemoveIfContains(item))
        {
            EventData data = new EventData();
            data.AddInt("ItemID", item.ItemID);

            SystemGrid.EventManager.SendEvent(Constants.GameEvent.ItemRemoved, data);
        }
    }
Example #6
0
    public void AddItem(Item item)
    {
        if (items.AddUnique(item))
        {
            EventData data = new EventData();
            data.AddInt("ItemID", item.ItemID);

            SystemGrid.EventManager.SendEvent(Constants.GameEvent.ItemAquired, data);
        }
    }
Example #7
0
    public override void RemoveItem()
    {
        fadeout.gameObject.SetActive(true);
        EventData data = new EventData();

        data.AddInt("ItemID", CurrentItem.ItemID);
        SystemGrid.EventManager.SendEvent(Constants.GameEvent.ItemUnequipped, data);

        base.RemoveItem();
    }
Example #8
0
    public void IncreaseMaximum(int value, bool temp = false)
    {
        if (resourceCap != 0 && maximumValue + value > resourceCap)
        {
            return;
        }

        maximumValue += value;

        EventData data = new EventData();

        data.AddInt("ResourceType", (int)resourceType);
        data.AddInt("Value", value);
        data.AddMonoBehaviour("Player", manager.owner);

        Grid.EventManager.SendEvent(Constants.GameEvent.ResourceChanged, data);


        UpdateText();
    }
Example #9
0
    private void SendStatChangeEvent(Entity causeOfChagne, Entity targetOfChagnge, Constants.BaseStatType stat, float value)
    {
        EventData data = new EventData();

        data.AddMonoBehaviour("Cause", causeOfChagne);
        data.AddMonoBehaviour("Target", targetOfChagnge);
        data.AddInt("Stat", (int)stat);
        data.AddFloat("Value", value);

        //Debug.Log("Event Sent: " + stat.ToString() + " :: " + value);
        EventGrid.EventManager.SendEvent(Constants.GameEvent.StatChanged, data);
    }
Example #10
0
    public bool RemoveResource(int value)
    {
        if (currentValue - value < 0)
        {
            return(false);
        }
        else
        {
            currentValue -= value;
            UpdateText();

            EventData data = new EventData();
            data.AddInt("ResourceType", (int)resourceType);
            data.AddInt("Value", -value);
            data.AddMonoBehaviour("Player", manager.owner);

            Grid.EventManager.SendEvent(Constants.GameEvent.ResourceChanged, data);

            return(true);
        }
    }
Example #11
0
    private void OnStatChanged(BaseStat.StatType type, GameObject cause)
    {
        //Local Event
        UpdateNavAgent(type);

        //Global Event
        EventData data = new EventData();

        data.AddInt("Type", (int)type);
        data.AddGameObject("Target", this.gameObject);
        data.AddGameObject("Cause", cause);
        EventGrid.EventManager.SendEvent(Constants.GameEvent.StatChanged, data);
    }
Example #12
0
    public void Attack(AnimationEvent animEvent)
    {
        //Debug.Log("Sending Attack");

        EventData data = new EventData();

        data.AddString("AttackName", animEvent.stringParameter);
        //data.AddMonoBehaviour("Entity", owner);
        data.AddInt("ID", owner.SessionID);

        //Debug.Log(owner.entityName + " " + owner.SessionID + " is sending an animation event");

        EventGrid.EventManager.SendEvent(Constants.GameEvent.AnimationEvent, data);
    }
Example #13
0
    public override void AssignItem(Item item)
    {
        base.AssignItem(item);

        //Debug.Log("Item with ID " + item.ItemID + " has been assigned to " + slotType + " slot");

        //Debug.Log("My current item's id is " + CurrentItem.ItemID);

        fadeout.gameObject.SetActive(false);
        EventData data = new EventData();

        data.AddInt("ItemID", CurrentItem.ItemID);
        SystemGrid.EventManager.SendEvent(Constants.GameEvent.ItemEquipped, data);
    }
Example #14
0
    public static void SendStatChangeEvent(GameObject source, GameObject target, StatType stat, float value)
    {
        EventData data = new EventData();

        data.AddGameObject("Cause", source);
        data.AddGameObject("Target", target);
        data.AddInt("Stat", (int)stat);
        data.AddFloat("Value", value);

        EventGrid.EventManager.SendEvent(Constants.GameEvent.StatChanged, data);


        Debug.Log(source.name + " has altered " + stat + " on " + target.name + " by " + value);
    }
    public static void SendStatChangeEvent(GameObject source, GameObject target, StatType stat, float value)
    {
        EventData data = new EventData();

        data.AddGameObject("Cause", source);
        data.AddGameObject("Target", target);
        data.AddInt("Stat", (int)stat);
        data.AddFloat("Value", value);

        EventGrid.EventManager.SendEvent(Constants.GameEvent.StatChanged, data);

        if (stat == StatType.Health && target != null)
        {
            VisualEffectLoader.MakeFloatingText(value.ToString(), target.transform.position);

            //Debug.Log(source.name + " has altered " + stat + " on " + target.name + " by " + value);
        }
    }
Example #16
0
    private void IncreaseDifficulty()
    {
        int currentDifficulty = (int)Difficulty;

        currentDifficulty++;

        if (currentDifficulty < System.Enum.GetValues(typeof(DifficultyLevel)).Length)
        {
            Difficulty = (DifficultyLevel)currentDifficulty;

            EventData data = new EventData();
            data.AddInt("DifficultyValue", (int)Difficulty);

            EventGrid.EventManager.SendEvent(Constants.GameEvent.DifficultyChange, data);

            Debug.Log("Difficulty Increased to: " + Difficulty);
        }
        else
        {
            Debug.Log("Max Difficulty Reached");
        }
    }