void Start()
    {
        enemyType = GetComponent <EnemyStats>().GetEnemyType();

        enemyAgent = GetComponent <NavMeshAgent>();

        targetTransform    = GameObject.FindWithTag("Player").GetComponent <Transform>();
        targetBehaviour    = targetTransform.gameObject.GetComponent <CharacterBehaviour>();
        basicAttackTrigger = GetComponentInChildren <AttackTrigger>();
        enemyAnimator      = GetComponentInChildren <Animator>();
        particleInstancer  = GameObject.FindWithTag("ParticleInstancer").GetComponent <ParticleInstancer>();
        enemyAudioPlayer   = GetComponent <AudioPlayer>();

        foreach (AnimationClip clip in enemyAnimator.runtimeAnimatorController.animationClips)
        {
            switch (enemyType)
            {
            case EnemyStats.EnemyType.Skull:
                if (clip.name == "hit")
                {
                    basicAttackDuration = clip.length;
                }
                if (clip.name == "appear")
                {
                    appearDelayTime = clip.length / 1.7f;
                }

                break;

            case EnemyStats.EnemyType.Fenrir:
                if (clip.name == "jumpIn")
                {
                    jumpInitDelayTime = clip.length;
                }
                if (clip.name == "jumpAttack")
                {
                    jumpAttackInitTime = clip.length;
                }

                break;

            default:
                break;
            }
        }

        enemyAgent.SetDestination(transform.position);

        enemySpeed        = enemyAgent.speed;
        enemyAngularSpeed = enemyAgent.angularSpeed;
        enemyAcceleration = enemyAgent.acceleration;

        if (enemyType == EnemyStats.EnemyType.Fenrir)
        {
            baAnimationLength = 5;
        }

        enemyHealthBar = GameObject.Find("GameplayUI").GetComponent <EnemyHealthBar>();
        endingPlayer   = enemyHealthBar.gameObject.GetComponent <PlayEnding>();
    }
Beispiel #2
0
 public AttackData(Attack newAtk)
 {
     atk            = newAtk;
     atk.attackName = "New Attack";
     comboStarterID = "";
     atkTrig        = AttackTrigger.Attack;
     input          = new List <AttackInput> ();
 }
Beispiel #3
0
 // Start is called before the first frame update
 void Start()
 {
     r2            = gameObject.GetComponent <Rigidbody2D>(); // Lay het cac thanh phan trong Rigidbody2D de co quyen truy xuat
     anim          = gameObject.GetComponent <Animator>();
     sprite_render = GetComponent <SpriteRenderer>();         // Cap quyen chinh cac thuoc tinh trong spriteReader
     pointscore    = GameObject.FindGameObjectWithTag("Point").GetComponent <PointScore>();
     attack        = GameObject.Find("AttackTrigger").GetComponent <AttackTrigger>();
     sm            = GameObject.FindGameObjectWithTag("Sound").GetComponent <SoundManager>();
     OurHeart      = MaxHeart;
 }
    void RegisterPlayer(string _ID)
    {
        IDs            = _ID;
        transform.name = "Character" + _ID;
        Character      = Player.transform.FindChild("Character" + _ID).gameObject;



        Healthbarcanvas     = Character.transform.FindChild("Healthbar canvas").gameObject;
        HealthBarBackground = Healthbarcanvas.transform.FindChild("Health background").gameObject;
        HealthIndicator     = HealthBarBackground.transform.FindChild("Health indicator").gameObject;
        Healthbar           = HealthIndicator.GetComponent <Image>();
        ThunderArrow        = Character.GetComponent <ThunderArrow>();
        Attackrange         = Character.transform.FindChild("AttackRange").gameObject;
        AttackTrigger       = Attackrange.GetComponent <AttackTrigger>();
        ItemTest            = Character.GetComponent <ItemTest>();
        inventorycanvas     = Player.transform.FindChild("Canvas").gameObject;
        tooltip             = inventorycanvas.transform.FindChild("Tooltip").gameObject;
        INVcancas           = inventorycanvas.GetComponent <Canvas>();
        Battletextmanager   = Player.transform.FindChild("BattleTextManager").gameObject;
        scrolltextmanager   = Battletextmanager.GetComponent <scrolltextmanager>();
        Inventory           = Player.transform.FindChild("Inventory").gameObject;
        showinv             = inventorycanvas.GetComponent <showinv>();
        inv         = Inventory.GetComponent <Inventory>();
        statscanvas = Player.transform.FindChild("Canvas - stats - map").gameObject;
        StatsPanel  = statscanvas.transform.FindChild("Stats Panel").gameObject;
        Statsloader = StatsPanel.GetComponent <Statsloader>();

        Camera = Player.transform.FindChild("Camera").gameObject;

        if (SceneManager.GetActiveScene().name != "Multiplayer Arena")
        {
            Teleporter = GameObject.Find("teleporter");
            teleporter = Teleporter.GetComponent <Teleporter>();
            teleporter.SetCharacter(_ID);
            shop       = GameObject.Find("Shop");
            shopdamage = shop.GetComponent <shopdamage>();
            shopdamage.shopset(_ID);
        }
        CameraControler = Camera.GetComponent <CameraControler>();
        PlayerAttack    = Character.GetComponent <PlayerAttack>();
        Tooltip         = tooltip.GetComponent <Tooltip>();
        ThunderArrow.Starting(_ID);
        AttackTrigger.setattack(_ID);
        scrolltextmanager.Set(_ID);
        inv.Houi(_ID);
        showinv.setupinventory(_ID);
        PlayerAttack.SetAttack(_ID);
        Statsloader.SetupStats(_ID);
        CameraControler.SetCamera(_ID);
        Tooltip.settooltip(_ID);
        inv.fillinventory();
    }
Beispiel #5
0
    void Start()
    {
        trigger             = GameObject.Find("Attack Target").GetComponent <AttackTrigger>();
        rend                = GameObject.Find("Monster 1").GetComponent <Renderer>();
        mTrackableBehaviour = GetComponent <TrackableBehaviour>();

        if (mTrackableBehaviour)
        {
            mTrackableBehaviour.RegisterTrackableEventHandler(this);
        }
        canvas.SetActive(false);
    }
Beispiel #6
0
 void Awake()
 {
     audioPlayer           = gameObject.GetComponent <AudioPlayer>();
     gm                    = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <Game_Master>();
     invMat                = gameObject.GetComponent <InvertMaterial>();
     player                = gameObject.GetComponent <Player_Controller>();
     anim                  = gameObject.GetComponent <Animator>();
     audioSource           = gameObject.GetComponent <AudioSource>();
     attackTrigger         = AttackObj.GetComponent <BoxCollider2D>();
     attackTrigger.enabled = false;
     atckTrig              = AttackObj.GetComponent <AttackTrigger>();
 }
    // stop attack, called in update method or checkAttack
    private void stopAttack()
    {
        if (!attacking)
        {
            return;
        }

        SetTrailOnOff(false);
        armActualAttack.DisableTrigger();
        armActualAttack   = null;
        airAttackJustDone = false;
        attacking         = false;
    }
    // called by update method, when I press attack button
    private void attack(Status s)
    {
        // If I'm already attacking, don't begin again
        if (attacking)
        {
            return;
        }

        SetTrailOnOff(true);

        switch (s)
        {
        // if I'm in idle status, I attack with one hand alternating
        case Status.IDLE:
        {
            attackIndex     = (attackIndex + 1) % (comboAttacks.Length - 1);     // -1 because the last attack is the air attack
            armActualAttack = hands[attackIndex];
            anim.Play(comboAttacks[attackIndex]);
            armActualAttack.EnableTrigger();
            PlayClip(ref missingHitSFX);
            break;
        }

        // if I'm falling, I can start only air attack
        case Status.FALLING:
        {
            if (!airAttackJustDone)
            {
                anim.Play(comboAttacks[attackIndex = comboAttacks.Length - 1]);
                armActualAttack = foots[0];
                armActualAttack.EnableTrigger();
                airAttackJustDone = true;
            }
            break;
        }

        // Start slide attack
        case Status.SLIDE:
        {
            anim.Play("Slide");

            armActualAttack = foots[0];
            armActualAttack.EnableTrigger();
            PlayClip(ref slideSFX);
            break;
        }
        }
        attacking = true;
    }
    void Start()
    {
        animator = GetComponent <Animator>();
        wielder  = transform.parent.gameObject;

        // Initialise attack trigger
        attackTrigger = GetComponentInChildren <AttackTrigger>();
        if (attackTrigger != null)
        {
            attackTrigger.OnAttackHit += OnAttackHit;
        }

        audioSource = GetComponent <AudioSource>();
        character   = transform.parent.GetComponent <Character>();
    }
Beispiel #10
0
    public virtual void StartAttack(AttackDirection direction, AttackTrigger trigger)
    {
        // if we're attacking and can't cancel, then return
        if (isAttacking && !canCancel)
        {
            return;
        }

        // get the movement controller state
        AttackPositionState state;

        if (movementControl.isJumping || movementControl.isFalling)
        {
            state = AttackPositionState.Air;
        }
        else if (movementControl.isDashing)
        {
            state = AttackPositionState.Dash;
        }
        else
        {
            state = AttackPositionState.Neutral;
        }

        if (InputAttackData[state][direction][trigger].Count != 0)
        {
            if (isAttacking && InputAttackData[state][direction][trigger].ContainsKey(currentAttack.attackID))
            {
                // go to the combo action this combination is associated with
                currentAttack = InputAttackData[state][direction][trigger][currentAttack.attackID];
            }
            else if (InputAttackData[state][direction][trigger].ContainsKey(""))
            {
                // go to the non-combo action this combination is associated with
                currentAttack = InputAttackData[state][direction][trigger][""];
            }
            else
            {
                // there is no attack available for this attack, return
                return;
            }

            // start the attack
            isAttacking = true;
            canCancel   = false;
            currentAttack.Activate();
        }
    }
Beispiel #11
0
    private void Start()
    {
        playerTransform        = GetComponent <Transform>();
        playerAgent            = GetComponent <NavMeshAgent>();
        hammerBehaviour        = GetComponentInChildren <HammerBehaviour>();
        basicAttackTrigger     = GetComponentInChildren <AttackTrigger>();
        cameraBehaviour        = GameObject.FindWithTag("CameraController").GetComponent <CameraBehaviour>();
        thorAnimator           = GetComponentInChildren <Animator>();
        timeManager            = GameObject.FindWithTag("manager").GetComponent <TimeManager>();
        audioPlayer            = GetComponent <AudioPlayer>();
        musicAmbientController = GameObject.FindWithTag("MusicAmbientController").GetComponent <MusicAmbientController>();

        foreach (AnimationClip animation in thorAnimator.runtimeAnimatorController.animationClips)
        {
            //animationsList.Add(new AnimationClipName(animation.name, animation));

            if (animation.name == "throwHammer")
            {
                throwDuration = animation.length / 1.4f;
            }
            if (animation.name == "hit_01")
            {
                attackDuration = animation.length;
            }
            if (animation.name == "slowArea")
            {
                slowAreaInitDelay = animation.length / 1.3f;
            }
            if (animation.name == "lightboltRain")
            {
                lightRainCastInitDuration = animation.length;
            }
        }

        agentSpeed = playerAgent.speed;

        maxLife         = life;
        playerHealthBar = GameObject.Find("GameplayUI").GetComponent <PlayerHealthBar>();
        StartCoroutine(SetInitLife());

        endingPlayer = playerHealthBar.gameObject.GetComponent <PlayEnding>();

        passiveInitDuration = passiveDuration;

        particleInstancer = GameObject.FindWithTag("ParticleInstancer").GetComponent <ParticleInstancer>();
    }
Beispiel #12
0
 public Weapon(Weapon other)
 {
     Name            = other.Name;
     DamageAmount    = other.DamageAmount;
     Range           = other.Range;
     HitNoise        = other.HitNoise;
     Mode            = other.Mode;
     Knockback       = other.Knockback;
     HitParticles    = other.HitParticles;
     HitColor        = other.HitColor;
     ProjectileType  = other.ProjectileType;
     LaunchSpeed     = other.LaunchSpeed;
     AnimationAsset  = other.AnimationAsset;
     TriggerMode     = other.TriggerMode;
     TriggerFrame    = other.TriggerFrame;
     HasTriggered    = false;
     DiseaseToSpread = other.DiseaseToSpread;
     ShootLaser      = other.ShootLaser;
 }
    // Token: 0x06000232 RID: 562 RVA: 0x0001BE78 File Offset: 0x0001A078
    public virtual void SwitchMode()
    {
        AttackTrigger attackTrigger = (AttackTrigger)this.GetComponent(typeof(AttackTrigger));

        if (attackTrigger.aimingType == AimType.Normal)
        {
            attackTrigger.aimingType = AimType.Raycast;
            if (attackTrigger.cameraZoomPoint)
            {
                ((ARPGcamera)attackTrigger.Maincam.GetComponent(typeof(ARPGcamera))).target = attackTrigger.cameraZoomPoint;
            }
            ((ARPGcamera)attackTrigger.Maincam.GetComponent(typeof(ARPGcamera))).targetHeight = this.targetHeightRayCast;
            ((ARPGcamera)attackTrigger.Maincam.GetComponent(typeof(ARPGcamera))).lockOn       = true;
        }
        else
        {
            attackTrigger.aimingType = AimType.Normal;
            ((ARPGcamera)attackTrigger.Maincam.GetComponent(typeof(ARPGcamera))).target       = this.transform;
            ((ARPGcamera)attackTrigger.Maincam.GetComponent(typeof(ARPGcamera))).targetHeight = this.targetHeightNormal;
            ((ARPGcamera)attackTrigger.Maincam.GetComponent(typeof(ARPGcamera))).lockOn       = false;
        }
    }
    // Use this for initialization
    void Start()
    {
        _anim      = GetComponent <Animator>();
        _rigidbody = GetComponent <Rigidbody2D>();

        _playerManager = GetComponent <PlayerManager>();

        _timeForDeath      = 3f;
        _timeForDeathCount = _timeForDeath;

        _attackTrigger = GetComponentInChildren <AttackTrigger>();

        if (!_playerExists)
        {
            _playerExists = true;
            DontDestroyOnLoad(transform.gameObject);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Beispiel #15
0
 public _0024MeleeDash_0024154(AttackTrigger self_)
 {
     _0024self__0024156 = self_;
 }
Beispiel #16
0
 void Awake()
 {
     attackTrigger = gameObject.GetComponentInChildren <AttackTrigger>();
 }
Beispiel #17
0
 void Start()
 {
     attackTrigger = GetComponentInParent <AttackTrigger>();
     boss          = GetComponentInParent <Boss>();
 }
Beispiel #18
0
 public _0024AttackCombo_0024148(AttackTrigger self_)
 {
     _0024self__0024153 = self_;
 }
 public AttackData(Attack newAtk)
 {
     atk = newAtk;
     atk.attackName = "New Attack";
     comboStarterID = "";
     atkTrig = AttackTrigger.Attack;
     input = new List<AttackInput> ();
 }
Beispiel #20
0
 public _0024MagicSkill_0024157(int skillID, AttackTrigger self_)
 {
     _0024skillID_0024163 = skillID;
     _0024self__0024164   = self_;
 }
Beispiel #21
0
 public _0024KnockBack_0024165(AttackTrigger self_)
 {
     _0024self__0024167 = self_;
 }
Beispiel #22
0
 internal void OnAttackTrigger(IEntity sender)
 {
     AttackTrigger?.Invoke(sender);
 }
    public virtual void StartAttack(AttackDirection direction, AttackTrigger trigger)
    {
        // if we're attacking and can't cancel, then return
        if (isAttacking && !canCancel) {
            return;
        }

        // get the movement controller state
        AttackPositionState state;
        if (movementControl.isJumping || movementControl.isFalling) {
            state = AttackPositionState.Air;
        } else if (movementControl.isDashing) {
            state = AttackPositionState.Dash;
        } else {
            state = AttackPositionState.Neutral;
        }

        if (InputAttackData[state][direction][trigger].Count != 0) {

            if (isAttacking && InputAttackData[state][direction][trigger].ContainsKey (currentAttack.attackID)) {

                // go to the combo action this combination is associated with
                currentAttack = InputAttackData[state][direction][trigger][currentAttack.attackID];

            } else if (InputAttackData[state][direction][trigger].ContainsKey ("")) {

                // go to the non-combo action this combination is associated with
                currentAttack = InputAttackData[state][direction][trigger][""];

            } else {

                // there is no attack available for this attack, return
                return;
            }

            // start the attack
            isAttacking = true;
            canCancel = false;
            currentAttack.Activate ();
        }
    }