Beispiel #1
0
    public virtual void CreateVFX()
    {
        if (string.IsNullOrEmpty(vfxName) == true)
        {
            return;
        }

        //if (activeVFX != null)
        //    return;


        GameObject loadedVFX = VisualEffectLoader.LoadVisualEffect("Particles", vfxName);

        if (loadedVFX == null)
        {
            Debug.LogError("Status couldn't load a vfx with name " + vfxName);
            return;
        }


        bool  facingLeft = Target.Entity().Movement.Facing == EntityMovement.FacingDirection.Left;
        float xOffset    = facingLeft == true ? vfxOffset.x * -1 : vfxOffset.x;

        Vector2 offset = new Vector2(xOffset, vfxOffset.y);

        activeVFX = GameObject.Instantiate(loadedVFX, Target.transform);
        activeVFX.transform.localPosition = Vector3.zero + (Vector3)offset;
    }
Beispiel #2
0
    private static GameObject LoadAndSpawnZonePrefab(ZoneInfo zoneInfo, Vector3 spawnPoint, Quaternion spawnRotation)
    {
        GameObject loadedPrefab = VisualEffectLoader.LoadVisualEffect(zoneInfo.shape, zoneInfo.size, zoneInfo.zoneName);

        if (loadedPrefab == null)
        {
            Debug.LogError("Could not load zone prefab with " + zoneInfo.shape + " " + zoneInfo.size + " " + zoneInfo.zoneName);
            return(null);
        }

        return(SpawnZonePrefab(loadedPrefab, spawnPoint, spawnRotation));
    }
Beispiel #3
0
    public virtual void CreateWeapon()
    {
        if (Source.Entity().WeaponCreated == true)
        {
            //Debug.Log("Weapon already made");

            if (parentAbility.OverrideOtherAbilities)
            {
                Source.Entity().CurrentWeapon.CleanUp();
            }
            else
            {
                InputBuffer.BufferAbility(parentAbility);
                return;
            }
        }

        //Debug.Log("makin' a weapon for " + parentAbility.abilityName);

        GameObject loadedPrefab = VisualEffectLoader.LoadVisualEffect("Weapons", weaponPrefabName);

        if (loadedPrefab == null)
        {
            Debug.LogError("Couldn't Load " + weaponPrefabName);
            return;
        }

        Transform point = Source.Entity().EffectDelivery.GetOriginPoint(effectOrigin);

        GameObject activeWeapon = GameObject.Instantiate(loadedPrefab, point);

        activeWeapon.transform.SetParent(point, false);
        activeWeapon.transform.localPosition = Vector3.zero;

        if (Source.Entity().Movement.Facing == EntityMovement.FacingDirection.Left)
        {
            activeWeapon.transform.localScale = new Vector3(
                activeWeapon.transform.localScale.x * -1,
                activeWeapon.transform.localScale.y,
                activeWeapon.transform.localScale.z);
        }

        WeaponDelivery delivery = activeWeapon.GetComponentInChildren <WeaponDelivery>();

        delivery.AnimHelper.PlayAnimTrigger(weaponAnimTrigger);
        Source.Entity().CurrentWeapon = delivery;
        Source.Entity().WeaponCreated = true;
        delivery.Initialize(this);
    }
Beispiel #4
0
    protected void CreateCorpse()
    {
        if (string.IsNullOrEmpty(projectileCorpse) == true)
        {
            return;
        }


        GameObject loadedPrefab = VisualEffectLoader.LoadVisualEffect("HitEffects", projectileCorpse);

        if (loadedPrefab == null)
        {
            Debug.LogError("Couldn't load a projectile impact");
            return;
        }

        Instantiate(loadedPrefab, transform.position, transform.rotation);
    }
    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);
        }
    }