示例#1
0
    void Start()
    {
        health = GetComponent <Health>();
        if (!plane)
        {
            plane = GameObject.Find("PlayerOne").transform;
        }
        activeTurret = false;
        if (!cam)
        {
            cam = transform.GetComponentInChildren <Camera>();
        }
        if (!lookAtMouse)
        {
            lookAtMouse = GetComponent <LookAtMouse>();
        }

        if (!LeftGun)
        {
            LeftGun = transform.FindChild("Left Gun").GetComponent <Animator>();
        }
        if (!RightGun)
        {
            RightGun = transform.FindChild("Right Gun").GetComponent <Animator>();
        }

        DeactivateTurret();
    }
示例#2
0
文件: Compressor.cs 项目: tgb20/LD42
 private void Start()
 {
     grabber           = GetComponentInChildren <GrabberDetector>();
     pMove             = GetComponentInParent <PlayerMovement>();
     lMouse            = GetComponent <LookAtMouse>();
     originalShipSpeed = pMove.speed;
     originalTurnSpeed = lMouse.rotationSpeed;
 }
示例#3
0
 protected override void Start()
 {
     base.Start();
     rb.useGravity    = false;
     lookAtMouse      = GetComponent <LookAtMouse>();
     lookAtMouse.look = false;
     camera           = FindObjectOfType <CameraFollow>();
     player           = camera.objectToFollow;
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     flatSceneEnabled = false;
     paused           = false;
     tutorial         = false;
     init             = true;
     LookAround       = GetComponent <LookAtMouse>();
     selectable       = GetComponent <SelectObject>();
 }
示例#5
0
 void Awake()
 {
     _animHolder       = GetComponent <AnimationsHolder>();
     _mouse            = GetComponent <LookAtMouse>();
     graphics          = transform;
     rigid             = GetComponent <Rigidbody2D>();
     _audioSource      = GetComponent <AudioSource>();
     _audioClip        = Resources.Load("Audio/Footstep") as AudioClip;
     _audioSource.clip = _audioClip;
 }
示例#6
0
 // Use this for initialization
 void Start()
 {
     charController = GetComponent<CharacterController>();
     workaround = true;
     smoothAnim = GetComponent<SmoothAnimScript>();
     lookAtMouse = GetComponent<LookAtMouse>();
     if (!crouched)
     {
         InvokeRepeating("Moving", 0.5f, 0.3f);
     }
 }
示例#7
0
    // Use this for initialization
    void Start()
    {
        isActive = false;
        distance = 1000000;
        player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();

        totalTimer = 5000;
        detonate = false;

        lookAtMouse = player.gameObject.GetComponent<LookAtMouse>();
    }
示例#8
0
 // Use this for initialization
 void Awake()
 {
     _player           = GameObject.FindGameObjectWithTag("Player");
     _MuzzleObj        = GameObject.FindGameObjectWithTag("Muzzle");
     _ShoulderObj      = GameObject.FindGameObjectWithTag("Shoulder");
     _bullet           = Resources.Load("Prefabs/Plasma_Bullet") as GameObject;
     _animationsHolder = _player.GetComponent <AnimationsHolder>();
     _mouse            = _player.GetComponent <LookAtMouse>();
     _audioSource      = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <AudioSource>();
     _clip             = Resources.Load("Audio/Gunsound") as AudioClip;
 }
示例#9
0
    private void Awake()
    {
        Player            = GameObject.Find("Player");
        PlayerRigidbody2D = Player.GetComponent <Rigidbody2D>();
        Hand              = Player.transform.GetChild(0).gameObject;
        ImmobilizeEntity  = Hand.GetComponent <ImmobilizeEntity>();
        MethodPassThrough = Hand.GetComponent <MethodPassThrough>();
        Rigidbody2D       = GetComponent <Rigidbody2D>();
        Camera            = FindObjectOfType <Camera>();
        LookAtMouse       = GetComponent <LookAtMouse>();
        WeaponThrown      = GetComponent <WeaponThrown>();

        _animator = transform.parent.GetComponent <Animator>();
    }
示例#10
0
    // Start is called before the first frame update
    void Start()
    {
        playerController     = GameObject.Find("Player").GetComponent <PlayerController>();
        lookAtMouse          = GameObject.Find("Player").GetComponent <LookAtMouse>();
        labyrinthManager     = GameObject.Find("LabyrinthManager").GetComponent <LabyrinthManager>();
        player               = GameObject.Find("Player");
        playerRb             = GameObject.Find("Player").GetComponent <Rigidbody>();
        mainCamera           = GameObject.Find("MainCamera");
        mainLight            = GameObject.Find("MainLight");
        smoothCameraTurning  = mainCamera.GetComponent <SmoothCameraTurning>();
        mainLightPointObject = GameObject.Find("MainLightPoint");
        mainLightPointLight  = mainLightPointObject.GetComponent <Light>();
        soundManager         = GameObject.Find("SoundManager").GetComponent <SoundManager>();

        lightIntensity = 0.5f;
    }
示例#11
0
    void Awake()
    {
        gc         = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController> ();
        es         = gc.gameObject.GetComponent <EnemySpawner> ();
        lam        = GameObject.FindGameObjectWithTag("Player").GetComponent <LookAtMouse> ();
        sr         = GetComponent <SpriteRenderer> ();
        bg         = GameObject.Find("Background").GetComponent <SpriteRenderer> ();
        shieldRing = GameObject.FindGameObjectWithTag("Player").transform.GetChild(2).gameObject;
        //select random powerups
        selection = (int)Random.Range(0f, powerupSprite.Length);

        sr.sprite = powerupSprite [selection];
        sr.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f);

        spawnTime    = Time.time;
        powerupTimer = GameObject.Find("PowerupTimer");
        powerupName  = GameObject.Find("PowerupName");
    }
示例#12
0
 public override void SingleFire(NetworkInstanceId netId)
 {
     if (lastFired + firerate < Time.time && (currAmmo > 0 || infiniteAmmo))
     {
         lastFired = Time.time;
         GameObject  newBullet = Instantiate <GameObject> (bullet, SpawnPos.transform.position, SpawnPos.transform.rotation);
         Rigidbody2D rb        = newBullet.GetComponent <Rigidbody2D> ();
         rb.velocity = GetComponent <Rigidbody2D> ().velocity;
         Vector2 forceOnBullet = SpawnPos.transform.right;
         float   theta         = Random.Range(-fireField / 2, fireField / 2) * Mathf.Deg2Rad;
         Vector2 rotated       = new Vector2(Mathf.Cos(theta) * forceOnBullet.x - Mathf.Sin(theta) * forceOnBullet.y, Mathf.Sin(theta) * forceOnBullet.x + Mathf.Cos(theta) * forceOnBullet.y);
         rb.AddForce(rotated * bulletVelocity, ForceMode2D.Impulse);
         newBullet.GetComponent <CollisionCorrection>().spawnedBy = netId;
         NetworkServer.Spawn(newBullet);
         Destroy(newBullet, bulletLifetime);
         currAmmo--;
         LookAtMouse.Recoil(-45, 6);
     }
 }
示例#13
0
 private void Start()
 {
     lookAtMouse = GameObject.Find("Player").GetComponent <LookAtMouse>();
 }
示例#14
0
 // Use this for initialization
 void Start()
 {
     rb = GetComponent<Rigidbody2D>();
     lookAtMouse = GetComponent<LookAtMouse>();
 }
示例#15
0
    //static int roll = Animator.StringToHash("Base Layer.Roll");
    //TODO: Set up states here using nameToHash
    // Use this for initialization
    void Start()
    {
        ph = GetComponent<PlayerHealth> ();
        animator = GetComponent<Animator> ();
        //		capCollider = GetComponent<CapsuleCollider> ();
        //		sphereCollider = GetComponent<SphereCollider> ();
        //rigidBody = GetComponent<Rigidbody> ();
        charController = GetComponent<CharacterController>();
        lookAtMouse = GetComponent<LookAtMouse>();
        //ps = GetComponentInChildren<ParticleSystem>();
        //ps.enableEmission = false;

        IsSettingViaScript = false;
    }
示例#16
0
    void Start()
    {
        health = GetComponent<Health>();
        if (!plane)
            plane = GameObject.Find("PlayerOne").transform;
        activeTurret = false;
        if (!cam)
            cam = transform.GetComponentInChildren<Camera>();
        if (!lookAtMouse)
            lookAtMouse = GetComponent<LookAtMouse>();

        if (!LeftGun)
            LeftGun = transform.FindChild("Left Gun").GetComponent<Animator>();
        if (!RightGun)
            RightGun = transform.FindChild("Right Gun").GetComponent<Animator>();

        DeactivateTurret();
    }
示例#17
0
 // Start is called before the first frame update
 void Start()
 {
     player          = GameObject.Find("Player");
     playerTransform = player.transform;
     lookAtMouse     = GameObject.Find("Player").GetComponent <LookAtMouse>();
 }
示例#18
0
    void Start()
    {
        laserBeam.gameObject.SetActive(false);
        lookAtMouseScript = masterEye.GetComponent <LookAtMouse>();
        oldMousePosition  = Input.mousePosition;
        platform          = GameObject.FindWithTag("Platform").GetComponent <Platform>();

        // get default glow color of blocks from any block
        defaultBlockMaterial = level.world[0, 0].GetComponentInChildren <Renderer>().sharedMaterial;
        // create lifted material (so it can be shared by all lifted blocks)
        liftedBlockMaterial = new Material(defaultBlockMaterial);
        liftedBlockMaterial.SetColor("_MKGlowColor", liftedBlockColor);


        // get spawn resource
        spawnResource = GetComponent <SpawnResource>();
        spawnResource.onChange.AddListener(() => spawnResourceText.text = spawnResource.currentValue + " $");

        // get material of master rail
        defaultRailMaterial = level.rail[0].GetChild(1).GetComponent <Renderer>().material;

        // stop blinking of lifted blocks
        for (int i = 0; i < level.world.GetLength(0); i++)
        {
            for (int u = 0; u < level.world.GetLength(1); u++)
            {
                var block = level.world[i, u].transform;
                if (block.position.y > blockMinYValue && block.tag.Equals("RoomBlock"))
                {
                    SetBlockMaterial(block, liftedBlockMaterial);
                }
            }
        }

        // unlocked units and obstacles
        #region
        if (GameData.Instance.suicideRobotUnlocked && !suicideRobot.activeSelf)
        {
            suicideRobot.SetActive(true);
        }
        if (GameData.Instance.sniperUnlocked && !sniper.activeSelf)
        {
            sniper.SetActive(true);
        }
        if (GameData.Instance.turretUnlocked && !turret.activeSelf)
        {
            turret.SetActive(true);
        }
        if (GameData.Instance.hackingAreaUnlocked && !hackingArea.activeSelf)
        {
            hackingArea.SetActive(true);
        }
        if (GameData.Instance.firewallUnlocked && !firewall.activeSelf)
        {
            firewall.SetActive(true);
        }
        if (GameData.Instance.fragmentationSawUnlocked && !fragmentation_Saw.activeSelf)
        {
            fragmentation_Saw.SetActive(true);
        }
        #endregion

        // start no spawn zone
        StartCoroutine(AutoUpdateNoSpawnZone());
    }
示例#19
0
文件: Sword.cs 项目: c0d3d1/LudemDare
 // Start is called before the first frame update
 void Start()
 {
     bc  = GetComponent <BoxCollider2D>();
     lam = GameObject.Find("MouseRegion").GetComponent <LookAtMouse>();
 }