public ProjectileAttributes(ProjectileAttributes copiedProjectileAttributes)
    {
        damage    = copiedProjectileAttributes.damage;
        knockback = copiedProjectileAttributes.knockback;

        isExplosive          = copiedProjectileAttributes.isExplosive;
        explosionDamage      = copiedProjectileAttributes.explosionDamage;
        explosionBlastRadius = copiedProjectileAttributes.explosionBlastRadius;
        explosionKnockback   = copiedProjectileAttributes.explosionKnockback;

        muzzleVelocity    = copiedProjectileAttributes.muzzleVelocity;
        ricochetCount     = copiedProjectileAttributes.ricochetCount;
        ricochetMaxAngle  = copiedProjectileAttributes.ricochetMaxAngle;
        gravityScale      = copiedProjectileAttributes.gravityScale;
        bouncinessMin     = copiedProjectileAttributes.bouncinessMin;
        bouncinessMax     = copiedProjectileAttributes.bouncinessMax;
        entityPenetration = copiedProjectileAttributes.entityPenetration;
        isSticky          = copiedProjectileAttributes.isSticky;
        stickyLifespan    = copiedProjectileAttributes.stickyLifespan;

        hasDelayedCollisionDetonation  = copiedProjectileAttributes.hasDelayedCollisionDetonation;
        delayedCollisionDetonationTime = copiedProjectileAttributes.delayedCollisionDetonationTime;

        projectileRadius  = copiedProjectileAttributes.projectileRadius;
        trailRendererTime = copiedProjectileAttributes.trailRendererTime;
        lifespan          = copiedProjectileAttributes.lifespan;

        prefab_Explosion = copiedProjectileAttributes.prefab_Explosion;

        clip_Collision = copiedProjectileAttributes.clip_Collision;
        clip_Explosion = copiedProjectileAttributes.clip_Explosion;
    }
 public ProjectileAttributesWrapper(ProjectileAttributes other) : base(other.Name)
 {
     ProjectileType      = other.ProjectileType;
     DetonationDelay     = other.DetonationDelay;
     Stages              = other.Stages?.ToArray();
     MissStageIndex      = other.MissStageIndex;
     MinimumMissDistance = other.MinimumMissDistance;
     MaximumMissDistance = other.MaximumMissDistance;
 }
    public Weapon(Weapon copiedWeapon)
    {
        name             = copiedWeapon.name;
        prefabPoolIndex  = copiedWeapon.prefabPoolIndex;
        weaponAttributes = new WeaponAttributes(copiedWeapon.weaponAttributes);

        projectileAttributes = new ProjectileAttributes(copiedWeapon.projectileAttributes);

        clip_Fire = copiedWeapon.clip_Fire;

        prefab_Projectile = copiedWeapon.prefab_Projectile;
    }
    void AdjustProjectilePositionAndRotation(GameObject projectile)
    {
        Vector3 shoulderToMouseDir = Camera.main.ScreenToWorldPoint(Input.mousePosition) - shoulder.position;

        shoulderToMouseDir.z           = 0;
        projectile.transform.position += (weapon_length * shoulderToMouseDir.normalized);

        ProjectileAttributes rotation_offset = projectile.GetComponent <ProjectileAttributes>();

        projectile.transform.eulerAngles = new Vector3(projectile.transform.eulerAngles.x,
                                                       projectile.transform.eulerAngles.y,
                                                       projectile.transform.eulerAngles.z + (rotation_offset ? rotation_offset.rotation_offset : 0.0f));
    }
Esempio n. 5
0
    private void AdjustProjectilePositionAndRotation(GameObject projectile)
    {
        Vector3 shoulderToMouseDir = player.transform.position - this.shoulder.position;

        shoulderToMouseDir.z           = 0;
        projectile.transform.position += (this.weapon_length * shoulderToMouseDir.normalized);

        ProjectileAttributes projectieAttributes = projectile.GetComponent <ProjectileAttributes>();

        projectile.transform.eulerAngles = new Vector3(projectile.transform.eulerAngles.x,
                                                       projectile.transform.eulerAngles.y,
                                                       projectile.transform.eulerAngles.z + (projectieAttributes ? projectieAttributes.rotation_offset : 0.0f));
    }
    // Start is called before the first frame update
    void Start()
    {
        shoulder           = transform.parent.transform;
        projectile_storage = new Queue <GameObject>();
        sound_player       = GetComponent <AudioSource>();

        p_itemManager = player_stats.GetComponent <ItemManager>();

        ProjectileAttributes pa = projectile.GetComponent <ProjectileAttributes>();

        if (pa)
        {
            sound_player.clip = pa.fired_sound;
        }
    }
Esempio n. 7
0
    public void SetTarget(GameObject target, ProjectileAttributes attributes, Quaternion rotation)
    {
        this.target = target;
        myAttributes = attributes;
        enemyLastSeen = target.transform.position;
        transform.rotation = rotation;

        if (!attributes.FollowsTarget)
        {
           BoxCollider2D box2D = gameObject.AddComponent<BoxCollider2D>();
           box2D.isTrigger = true;
           Rigidbody2D rb = gameObject.AddComponent<Rigidbody2D>();
           rb.gravityScale = 0;
        }
    }
Esempio n. 8
0
    // Start is called before the first frame update
    private void Start()
    {
        if (this.player == null)
        {
            this.player = GameObject.Find("Character");
        }

        this.shoulder           = this.transform.parent.transform;
        this.projectile_storage = new Queue <GameObject>();
        this.sound_player       = this.GetComponent <AudioSource>();

        ProjectileAttributes pa = this.projectile.GetComponent <ProjectileAttributes>();

        if (pa)
        {
            this.sound_player.clip = pa.fired_sound;
        }

        this.gameObject.layer = 8;
    }
    public void InitializeProjectile(int newProjectileId, ProjectileAttributes newProjectileAttributes, NetworkPerspective newNetworkPerspective, Player player)
    {
        // Get References
        projectileCollider = GetComponent <SphereCollider>();
        model         = transform.Find("(Model)");
        trailRenderer = model.GetComponent <TrailRenderer>();

        // Add parentPlayer to damagedEntities as to ignore it on collision
        //damagedEntities.Add(player);

        // Set Attributes
        projectileId         = newProjectileId;
        projectileAttributes = new ProjectileAttributes(newProjectileAttributes);
        networkPerspective   = newNetworkPerspective;
        parentPlayer         = player;

        // Utilize Attributes
        model.transform.localScale = Vector3.one * projectileAttributes.projectileRadius * 2;
        velocity = transform.forward * projectileAttributes.muzzleVelocity;
        projectileCollider.radius     = projectileAttributes.projectileRadius;
        trailRenderer.widthMultiplier = projectileAttributes.projectileRadius * 2;
        trailRenderer.time            = projectileAttributes.trailRendererTime;
        timeCreated = Time.time;
    }