Example #1
0
 // Use this for initialization
 void Start()
 {
     healthsys       = GetComponent <NPCHealth>();
     enemycontroller = GetComponent <CharacterController>();
     routes          = route.GetComponentsInChildren <Transform>();
     shiftAll();
 }
Example #2
0
 /// <summary>
 /// Make an hit on other gameobject. 
 /// </summary>
 public void ShootAtNPC()
 {
     npcHealth = npc.GetComponent<NPCHealth>();
         lineBullet.enabled = true;
         lineBullet.SetPosition(0, transform.position);
         lineBullet.SetPosition(1, npc.transform.position);
         npcHealth.TakeDamage(weaponDamage);
 }
Example #3
0
 // Use this for initialization
 void Start()
 {
     rg           = GetComponent <Rigidbody2D>();
     healthScript = GetComponent <NPCHealth>();
     if (ImpactSoundScript == null)
     {
         ImpactSoundScript = GetComponent <PlaySoundClipImpactSoundsPlayer>();
     }
 }
    //private NavMeshAgent agent;

    private void Awake()
    {
        health               = GetComponent <Health>();
        health.Healed       += Health_Healed;
        npchealth            = GetComponent <NPCHealth>();
        npchealth.Died      += NPCHealth_Died;
        compVillagerMovement = GetComponent <VillagerMovement>();
        ts = GetComponent <TimeScale>();
        //agent = GetComponent<NavMeshAgent>();
    }
Example #5
0
    private void ShootAtNPC()
    {
        bullet = prefabSource.Bullet();
        npcHealth = npc.GetComponent<NPCHealth>();

        GameObject bulletCopy = (GameObject)Instantiate(bullet, transform.position, transform.rotation);
        bulletCopy.SetActive(true);

        Shoot script_b = bulletCopy.GetComponent<Shoot>();
        script_b.SetStart(transform, npc.transform, transform.gameObject);
    }
Example #6
0
    private void Awake()
    {
        navMeshA     = GetComponent <NavMeshAgent>();
        player       = Camera.main.transform.root.gameObject;
        patrolPoints = FindObjectsOfType <PatrolPoint>();

        if (GetComponent <NPCHealth>())
        {
            npcHealth = GetComponent <NPCHealth>();
        }
    }
Example #7
0
 /// <summary>
 /// Make an hit on other gameobject. 
 /// </summary>
 public void ShootAtNPC()
 {
     npcState = false;
     bullet = prefabSource.Bullet();
     npcHealth = npc.GetComponent<NPCHealth>();
     GameObject bulletCopy = (GameObject)Instantiate(bullet, transform.position, transform.rotation);
     bulletCopy.SetActive(true);
     Shoot script_b = bulletCopy.GetComponent<Shoot>();
     script_b.SetStart(transform, npc.transform, transform.gameObject);
     if (gatlingControll.RotateSpeed < 15f)gatlingControll.RotateSpeed = gatlingControll.RotateSpeed + 1f;
     if (delay <= 0.22f && delay > 0.05f) delay = delay - 0.01f;
 }
Example #8
0
    /// <summary>
    /// Initialize single shoot to one NPC
    /// </summary>
    /// <param name="npcEnemy"> target </param>
    /// <param name="towerWeapon"> weapon typ </param>
    public void Shoot(GameObject npcEnemy, GameObject towerWeapon)
    {
        bullet = prefabSource.Bullet();
        npc = npcEnemy;

        npcHealth = npcEnemy.GetComponent<NPCHealth>();
        GameObject bullet_2 = (GameObject)Instantiate(bullet, transform.position, towerWeapon.transform.rotation);
        bullet_2.SetActive(true);

        Shoot script_b = bullet_2.GetComponent<Shoot>();
        script_b.SetStart(transform, npcEnemy.transform, transform.gameObject);
    }
 public void Init()
 {
     if (TrackedTarget == null)
     {
         return;
     }
     playersHealth          = TrackedTarget.GetComponent <NPCHealth>();
     playersUpgrades        = TrackedTarget.GetComponent <Upgrades>();
     playersInventory       = TrackedTarget.GetComponent <PlayerInventory>();
     playersId              = TrackedTarget.GetComponent <PlayerId>();
     playersId.CameraScript = this;
     cam = GetComponent <Camera>();
 }
Example #10
0
        void Awake()
        {
            // Set up the references.

            //player = GameObject.Find("Player").transform;
            //playerHealth  = players.GetComponent<TankHealth>();
            enemyHealth = GetComponent <NPCHealth>();
            nav         = GetComponent <NavMeshAgent>();

            //EnemyAnim = GetComponent<Animator>();

            PlayerMovScript = FindObjectOfType <TankMovement>();
        }
Example #11
0
    void Awake()
    {
        _agent       = GetComponent <NavMeshAgent>();
        playerObject = PlayerController.Instance.gameObject;
        patrolPoints = FindObjectsOfType <PatrolPoint>();

        if (GetComponent <NPCHealth>())
        {
            npcHealth = GetComponent <NPCHealth>();
        }

        PlayerCam = Tools.MainCamera().gameObject;
    }
Example #12
0
File: NPC.cs Project: Kimsy99/c-19
    void Awake()
    {
        spriteFlippable2D = GetComponent <SpriteFlippable2D>();
        flashable         = GetComponent <Flashable>();
        health            = GetComponent <NPCHealth>();
        movement          = GetComponent <NPCMovement>();
        Transform weaponHolderTransform = transform.Find("WeaponHolder");

        if (weaponHolderTransform != null)
        {
            weaponHolder = weaponHolderTransform.gameObject;
        }
        heldWeapon = GetComponentInChildren <NPCHeldWeapon>();
    }
Example #13
0
 void Awake()
 {
     playerID     = GetComponent <PlayerId>();
     upgrades     = GetComponent <Upgrades>();
     healthScript = GetComponent <NPCHealth>();
     rg           = GetComponent <Rigidbody2D>();
     if (jetpackSound != null)
     {
         jetSource = jetpackSound.GetComponent <AudioSource>();
         soundBase = jetSource.volume;
     }
     //drillMask = LayerMask.NameToLayer("Diggable");
     oldTimer    = unDeployTimer;
     engineSound = GetComponent <AudioSource>();
 }
Example #14
0
    protected override void OnLaserHit(RaycastHit2D hit)
    {
        if (hit.collider.gameObject.layer != LayerMask.NameToLayer("Enemy"))
        {
            return;
        }
        NPCHealth  npcHealth  = hit.collider.gameObject.GetComponentInParent <NPCHealth>();
        BossHealth bossHealth = hit.collider.gameObject.GetComponentInParent <BossHealth>();

        if (npcHealth != null)
        {
            npcHealth.Damage(damage, true);
        }
        else if (bossHealth != null)
        {
            bossHealth.Damage(damage, true);
        }
    }
Example #15
0
    //the object which you place
    //the object which you use to teleport


    // Use this for initialization
    void Awake()
    {
        upgrades     = GetComponent <Upgrades>();
        healthScript = GetComponent <NPCHealth>();
        idScript     = GetComponent <PlayerId>();
    }
Example #16
0
 void Awake()
 {
     NPCTargeting = GetComponent <NPCTargeting> ();
     myTag        = GetComponent <Tag> ();
     NPCHealth    = GetComponent <NPCHealth>();
 }
Example #17
0
 // Use this for initialization
 void Start()
 {
     parent       = transform.parent;
     healthScript = GetComponent <NPCHealth>();
 }
Example #18
0
 // Use this for initialization
 void Awake()
 {
     script           = GetComponent <PlaySoundClipImpactSound>();
     health           = GetComponent <NPCHealth>();
     originalcooldown = cooldown;
 }
Example #19
0
 private void Awake()
 {
     npchealth        = GetComponent <NPCHealth>();
     npchealth.Died  += NPCHealth_Died;
     cmpEnemyMovement = GetComponent <EnemyMovement>();
 }