示例#1
0
    public override IAbilityComponent Duplicate()
    {
        CooldownAbility copy = new CooldownAbility(Data, ParentAbility);

        copy.cooldownRemaining = cooldownRemaining;
        return(copy);
    }
示例#2
0
    void Start()
    {
        cam = Camera.main.gameObject.GetComponent <CameraControl>();

        projectileSpawner = this.gameObject.GetComponentInParent <ProjectileSpawner>();
        if (projectileSpawner == null)
        {
            projectileSpawner = this.gameObject.AddComponent <ProjectileSpawner>();
        }

        audioSource = this.GetComponentInParent <AudioSource>();
        if (audioSource == null)
        {
            audioSource = this.gameObject.AddComponent <AudioSource>();
        }
        emptySoundSource             = this.gameObject.AddComponent <AudioSource>();
        emptySoundSource.playOnAwake = false;

        projectileSpawner.thrust      = projectileSpeed;
        projectileSpawner.projectile  = projectile;
        projectileSpawner.cooldown    = fireDelay;
        projectileSpawner.mouseAim    = true;
        projectileSpawner.onlyForward = true;

        reloadAbility          = this.gameObject.AddComponent <GenericAbility>();
        reloadAbility.cooldown = reloadDelay;

        ammoCount = clipSize;//Start full

        myCollider = this.gameObject.GetComponent <Collider2D>();
        myRigid    = this.gameObject.GetComponent <Rigidbody2D>();
        owner      = this.gameObject.GetComponentInParent <Attributes>();
        if (!owner && !myRigid)
        {
            myRigid = this.gameObject.AddComponent <Rigidbody2D>();
        }
    }
示例#3
0
 public void CooldownIsEnabledAfterFirstInvocation()
 {
     CooldownAbility cooldownAbility
         = RequisiteHelper
           .CreateActiveAbility(phase: default, (h, c) => { })
        public void ReloadSlowdownMathChecksOut(IActiveAbility ability, TimeSpan expectedCooldown)
        {
            CooldownAbility autoAttack = ability.WithCooldown(TimeSpan.FromSeconds(5.0));

            Hero         hero         = new Hero(team: default, new HitPoints(9999), autoAttack, DecreaseAllTimersAbility.Instance, new ReloadSlowdownAbility(0.5));