Ejemplo n.º 1
0
    private void FireWeapon(PerformedRangeAttackActorEventArgs args)
    {
        ClipStatusText.text =
            (CombatManager.AmmoInClip > numberOfBulletReps) ?
            "+ " + (CombatManager.AmmoInClip - numberOfBulletReps).ToString() : "";

        if (CombatManager.AmmoInClip < numberOfBulletReps)
        {
            ClipRepresentation [CombatManager.AmmoInClip].enabled = false;
        }
    }
Ejemplo n.º 2
0
    public void CreateRangedAttack(Attack att, Vector3 direction)
    {
        if (att.Type == AttackType.Projectile)
        {
            PerformedRangeAttackActorEventArgs args =
                new PerformedRangeAttackActorEventArgs(att, this, this.transform.position, direction, projectileSpawnOffset, 65f);

            if (OnRangedAttack != null)
            {
                OnRangedAttack(args);
            }
        }
    }
Ejemplo n.º 3
0
    private void SpawnProjectile(PerformedRangeAttackActorEventArgs args)
    {
        GameObject bullet = (GameObject)Instantiate
                                (projectilePrefab,
                                args.OriginPoint + (new Vector3(args.Direction.x, 0, args.Direction.z)).normalized * (args.SpawnOffset + projectileRadius),
                                new Quaternion()
                                );

        ProjectileScript temp = bullet.GetComponent <ProjectileScript> ();

        //float tmprand = GameRandom.NextFloat (-10, 10);
        Vector3 dir =
            Quaternion.AngleAxis(GameRandom.NextFloat(-2.5f, 2.5f), Vector3.up) *
            Quaternion.AngleAxis(GameRandom.NextFloat(-5, 5), Vector3.right) *
            args.Direction.normalized;

        //Debug.Log (dir);

        temp.AttackData = args.Attack;
        temp.Direction  = dir;
        temp.Velocity   = args.ProjectileVelocity;

        //bullet.GetComponent<Rigidbody> ().velocity = args.Direction.normalized * args.ProjectileVelocity;
    }
Ejemplo n.º 4
0
 private void HandleRangedAttack(PerformedRangeAttackActorEventArgs args)
 {
     SpawnProjectile(args);
 }