Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        // get animator, rb
        animator = GetComponent <Animator>();
        rb2D     = this.GetComponent <Rigidbody2D>();

        // init state
        state = STATE.NORMAL;

        // init skills
        Skill dash   = new DashSkill();
        Skill magnet = new MagnetSkill(number);

        skills = new Skill[] { dash, magnet };

        foreach (Skill skl in skills)
        {
            skl.Init();
        }

        item = null;

        // get skill board
        myTextBoard = GameObject.Find(textBoardName[number]).GetComponent <Text>();

        // init cmdHolder
        cmdHolder = new CommandHolderKeyboard(number);
    }
Beispiel #2
0
    public override PlayerSkill Clone(GameObject target)
    {
        DashSkill other = target.AddComponent <DashSkill>();

        other.LongDashChargeThreshold  = LongDashChargeThreshold;
        other.ShortDashDistance        = ShortDashDistance;
        other.ShortDashTime            = ShortDashTime;
        other.FreezeMovmentControlTime = FreezeMovmentControlTime;
        other.InvincibilityTime        = InvincibilityTime;
        other.Radius = Radius;

        return(other);
    }
Beispiel #3
0
    public override void Activate(MonsterCharacter character, int index)
    {
        //would result in illegal normalization, need a direction to dash into
        if (character.physicsBody.velocity == Vector2.zero)
        {
            return;
        }

        //need 65% of full power at minimum
        if (character.ChargePoints < (ChargeCost * .65f))
        {
            Sounds.CreateSound(FailSound);
            Messaging.GUI.ScreenMessage.Invoke("NOT ENOUGH CHARGE", Color.red);
            return;
        }

        if (character.SkillCooldowns[index] > 0)
        {
            Sounds.CreateSound(FailSound);
            return;
        }

        Sounds.CreateSound(ActivationSound);

        character.SkillCooldowns[index] = Cooldown;

        float strength = Strength;

        if (character.ChargePoints < ChargeCost)
        {
            strength *= (float)character.ChargePoints / ChargeCost;
            character.ChargePoints = 0;
        }
        else
        {
            character.ChargePoints -= ChargeCost;
        }

        DashSkill d = Instantiate(this, LevelLoader.DynamicObjects);

        d.Strength        = strength;
        d.direction       = character.physicsBody.velocity.normalized;
        d.targetCharacter = character;
        d.timer           = ActiveTime;

        if (AttachmentEffect != null)
        {
            foreach (string attachPoint in AttachmentPoints)
            {
                GameObject effect = Instantiate(AttachmentEffect);

                GenericTimer e = effect.AddComponent <GenericTimer>();
                e.LifeTime = ActiveTime * 5;
                e.OnTimer.AddListener(() =>
                {
                    TrailRenderer tr = effect.GetComponentInChildren <TrailRenderer>();
                    if (tr != null)
                    {
                        tr.emitting = false;
                    }
                });

                DestroyAfterTime t = effect.AddComponent <DestroyAfterTime>();
                t.LifeTime = ActiveTime * 10;

                effect.transform.SetParent(character.GetAttachmentPoint(attachPoint), false);
            }
        }
    }
Beispiel #4
0
 private void Awake()
 {
     _playerMovement    = GetComponent <PlayerMovement>();
     _swordOfChaosSkill = GetComponent <SwordOfChaosSkill>();
     _dashSkill         = GetComponent <DashSkill>();
 }
Beispiel #5
0
 private void Awake()
 {
     _dashSkill = GetComponent <DashSkill>();
 }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        // get animator, rb
        animator = GetComponent<Animator>();
        rb2D = this.GetComponent<Rigidbody2D>();

        // init state
        state = STATE.NORMAL;

        // init skills
        Skill dash = new DashSkill();
        Skill magnet = new MagnetSkill(number);
        skills = new Skill[] { dash, magnet };

        foreach (Skill skl in skills) {
            skl.Init();
        }

        item = null;

        // get skill board
        myTextBoard = GameObject.Find(textBoardName[number]).GetComponent<Text>();

        // init cmdHolder
        cmdHolder = new CommandHolderKeyboard(number);
    }
 private void Awake()
 {
     _healthController = GetComponent <HealthController>();
     _dashSkill        = GetComponent <DashSkill>();
 }