Inheritance: MonoBehaviour
コード例 #1
0
    protected override void OnHit(Shooting shooting, Enemy enemy, Vector3 contactPoint)
    {
        var level = shooting.BowLevel;
        enemy.Health -= Power[Math.Min(level - 1, 2)] * Time.deltaTime;

        base.OnHit(shooting, enemy, contactPoint);
    }
コード例 #2
0
    protected override void OnHit(Shooting shooting, Enemy enemy, Vector3 contactPoint)
    {
        var level = shooting.CrossLevel;
        enemy.Health -= Power[Math.Min(level - 1, 2)];

        if (LockedTo != null)
            LockedTo.LockedOn = false;

        var dead = enemy.Health <= 0;

        if (dead && !enemy.Dead)
        {
            var xploGo = (GameObject)Instantiate(Shooting.ExplosionTemplate);
            xploGo.transform.position = enemy.transform.position;
            xploGo.transform.rotation = Random.rotation;
            if (enemy is SingleShotBehaviour && (enemy as SingleShotBehaviour).invertColors)
                xploGo.renderer.material = ColorShifting.Materials["clr_Red"];
            else
                xploGo.renderer.material = ColorShifting.Materials[ColorShifting.EnemyMaterials[enemy.GetType()]];
        }

        base.OnHit(shooting, enemy, contactPoint);

        Destroy(gameObject);
    }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        player = GetComponent <SetPlayerLocation> ().player;
        if (player != null)
        {
            inputDevice = player.GetComponent <Movement> ().getInputDevice();
            shooting    = player.GetComponent <Shooting> ();
            if (shootSound == null)
            {
                shootSound = player.transform.Find("Soundbox").Find("cannonsound").gameObject.GetComponent <AudioSource>();
            }
        }
        else
        {
            return;
        }


        if (inputDevice != null)
        {
            //camera rotation
            if (inputDevice.RightBumper.IsPressed && shooting.snowAmount > 0 && !isShooting)
            {
                StartCoroutine("ShootBall");
            }
        }
    }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ShootingId,NumberOfShoots,CreationDateTime,IsFinished")] Shooting shooting)
        {
            if (id != shooting.ShootingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(shooting);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShootingExists(shooting.ShootingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(shooting));
        }
コード例 #5
0
    void Start()
    {
        canPlay = false;

        body = GetComponent <Rigidbody>();

        myNormal = transform.up;

        gui = gameObject.GetComponent <GuiVehicle> ();

        //frontWheel = new Vector3();
        //backWheel = new Vector3();

        ray = new Ray();

        shooting = GetComponent <Shooting> ();

        velocity = Vector3.zero;

        /*if (team == 0) {
         *      GetComponent<MeshRenderer> ().material.color = Color.blue;
         *      gameObject.tag = "VehicleTeam0";
         * } else if(team == 1){
         *      GetComponent<MeshRenderer> ().material.color = Color.red;
         *      gameObject.tag = "VehicleTeam1";
         * }*/
    }
コード例 #6
0
    private void Update()
    {
        Shooting.Shoot();
        Movement.SetLookTarget(m_LookAngle);

        m_LookAngle += Time.deltaTime * rotateSpeed;
    }
コード例 #7
0
    void Update()
    {
        timer  += Time.deltaTime;
        canFire = timer > firerate;


        GameObject Player = GameObject.Find("Player");
        BoxHP      BoxHP  = Player.GetComponent <BoxHP> ();

        GameObject Pistol   = GameObject.Find("Pistol");
        Shooting   Shooting = Player.GetComponent <Shooting> ();

        if (BoxHP.currenthp <= 0)
        {
            Shooting.secondary.SetActive(false);
            Shooting.primary.SetActive(true);
            currentWeapon             = Shooting.primary.GetComponent <BaseWeapon> ();
            currentWeapon.currentAmmo = 15;             //currentWeapon.maxAmmo;
            canFire = false;
            Debug.Log(canFire + " " + reloading + " " + currentAmmo + currentWeapon);
            Shooting.secondary.SetActive(false);
            Shooting.primary.SetActive(true);
            canFire = true;
            currentWeapon.currentAmmo = 15;
        }

        if (currentWeapon = Shooting.primary.GetComponent <BaseWeapon> ())
        {
            canFire = true;
            Shooting.secondary.SetActive(false);
        }
    }
コード例 #8
0
    void Start()
    {
        allSlots = 25;
        slot     = new GameObject[allSlots];

        allSlots2 = 24;
        slot2     = new GameObject[allSlots2];

        for (int i = 0; i < allSlots; i++)
        {
            slot[i] = slotHolder.transform.GetChild(i).gameObject;

            if (slot[i].GetComponent <Slot>().item == null)
            {
                slot[i].GetComponent <Slot>().empty = true;
            }
        }

        for (int j = 1; j < allSlots2; j++)
        {
            slot[j] = slotHolder.transform.GetChild(j).gameObject;

            if (slot[j].GetComponent <Slot>().item == null)
            {
                slot[j].GetComponent <Slot>().empty2 = true;
            }
        }
        shooting_Script = firePoint.GetComponent <Shooting>();

        item_Script = TheFireItem.GetComponent <Item>();
    }
コード例 #9
0
ファイル: Bullet.cs プロジェクト: Yuuyake/Ranger-Unity
    // TO DO x + y nin r kadar çapında aynı ses çıkması lazım, kalanı random
    void OnCollisionEnter2D(Collision2D collision)
    {
        int randy  = rnd.Next(1, 4);
        var hitter = collision.gameObject;

        Vector2 tempV = collision.contacts[0].point;
        //print("HITTER ANGLE : " + bulletAngle);
        Vector2 shootingVector = Shooting.AddAngleToVector(bulletAngle, new Vector2(1, 0));

        if (hitter.name.Contains("Enemy"))
        {
            Shooting.FireWithAngle(usedArrow, hitter.transform, shootingVector, 0);
            Shooting.FireWithAngle(usedArrow, hitter.transform, shootingVector, 15);
            Shooting.FireWithAngle(usedArrow, hitter.transform, shootingVector, -15);
        }
        else
        {
            if (randy == 1)
            {
                onHitNonEnemy1.Play();
            }
            else if (randy == 2)
            {
                onHitNonEnemy2.Play();
            }
            else
            {
                onHitNonEnemy3.Play();
            }
        }
        GameObject arrowHitEffect = Instantiate(hitEffect, tempV, Quaternion.identity);

        Destroy(arrowHitEffect, 1f);
        Destroy(gameObject);
    }
コード例 #10
0
 private void Awake()
 {
     animator           = GetComponent <Animator>();
     shootingController = GetComponent <Shooting>();
     rb = GetComponent <Rigidbody2D>();
     Physics2D.IgnoreLayerCollision(6, 7);
 }
コード例 #11
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("Player enter collider"); //collider works
        if (other.tag == "Player")          //if collides with the mesh tagged player
        {
            if (taken == false)
            {
                print("has been taken");
                taken = true;
                t     = 0;
                int wpn = RandomPrefab();

                //respawn game object
                // get world postion
                GameObject weaponGenetor  = Resources.Load("Prefab/randomWeapon") as GameObject;
                Vector3    weaponLocation = transform.position;


                //is respawning needs detla time, give time in between


                //need to create sprite animation, with a GUI Layout
                GameObject prefab = WeaponPrefabs[wpn];
                Shooting   Shoot  = other.GetComponentInParent <Shooting>();
                Shoot.Secondary = prefab;
                //need to destroy game object

                GetComponent <NetworkView>().RPC("setEnable", RPCMode.AllBuffered, false);
            }
        }
    }
コード例 #12
0
 // Start is called before the first frame update
 void Start()
 {
     m_shooting            = GetComponent <Shooting>();
     m_rotateObject        = GetComponent <RotateObject>();
     m_wanderAiForShooting = GetComponent <WanderAIForShooting>();
     StartCoroutine("CalledUpdateTarget");
 }
コード例 #13
0
    public void Setup()
    {
        m_Movement = m_Instance.GetComponent <Movement>();
        m_Shooting = m_Instance.GetComponent <Shooting>();
        m_Shield   = m_Instance.GetComponent <Shield>();

        m_Movement.m_IATank = m_TankIA.m_IATank;
        m_Shooting.m_IATank = m_TankIA.m_IATank;
        m_Shield.m_IATank   = m_TankIA.m_IATank;

        m_CanvasGameObject = m_Instance.GetComponentInChildren <Canvas>().gameObject;

        if (m_isReplay)
        {
            m_Health = m_Instance.GetComponent <Health> ();
            m_Instance.GetComponent <BoxCollider> ().enabled = false;
            m_Movement.m_TimeReference = m_TimeReference;
            m_Shooting.m_TimeReference = m_TimeReference;
            m_Shield.m_TimeReference   = m_TimeReference;
            m_Health.m_TimeReference   = m_TimeReference;
        }

        m_Movement.m_PlayerNumber = m_PlayerNumber;
        m_Shooting.m_PlayerNumber = m_PlayerNumber;
        m_Shield.m_PlayerNumber   = m_PlayerNumber;

        m_ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(m_PlayerColor) + ">PLAYER " + m_PlayerNumber + "</color>";

        MeshRenderer[] renderers = m_Instance.GetComponentsInChildren <MeshRenderer>();

        for (int i = 0; i < renderers.Length; i++)
        {
            renderers[i].material.color = m_PlayerColor;
        }
    }
コード例 #14
0
    private void Start()
    {
        PV = GetComponent <PhotonView>();
        if (PV.IsMine)
        {
            PlayerCam.gameObject.SetActive(true);

            //Set Controller Strings
            LeftAnalogXString        = "LeftAnalogX1";        //+ PlayerID.ToString();
            LeftAnalogYString        = "LeftAnalogY1";        //+ PlayerID.ToString();
            ControllerJumpString     = "ControllerJump1";     //+ PlayerID.ToString();
            ControllerDashString     = "ControllerDash1";     //+ PlayerID.ToString();
            ControllerLoadString     = "ControllerLoad1";     //+ PlayerID.ToString();
            ControllerInteractString = "ControllerInteract1"; //+ PlayerID.ToString();
            SpawnPointList           = GameObject.FindGameObjectsWithTag("PlayerSpawn");

            //Set Components to Variables at Start of Script
            Player            = GetComponent <Transform>();
            CharacterAnimator = GetComponent <Animator>();
            CharController    = GetComponent <CharacterController>();
            shootingScript    = GetComponentInParent <Shooting>();
            PlayerHealth      = GetComponent <Target>();

            tempClimbTimer   = climbWallTimer;
            tempRespawnTimer = respawnTimer;

            dashCountdownUI = dashCooldown + 1;
        }
    }
コード例 #15
0
    private void Update()
    {
        if (photonView.isMine == false)
        {
            return;
        }

        m_UpdateTargetTimer      += Time.deltaTime;
        m_UpdateTargetPointTimer += Time.deltaTime;

        if (m_UpdateTargetTimer >= updateTargetTime)
        {
            SelectNewTarget();
            m_UpdateTargetTimer = 0;
        }

        if (m_UpdateTargetPointTimer >= updateTargetPointTime)
        {
            UpdateTargetPoint();
            m_UpdateTargetPointTimer = 0;
        }

        float lookTarget = centerAngle + angleRadius * Mathf.Sin(Time.time * rotateSpeed);

        Movement.SetLookTarget(lookTarget);

        if (Target != null && m_TargetPoint != Vector3.zero)
        {
            float ang = GetAngle(m_TargetPoint);
            if (ang < shootAngleThreshold)
            {
                Shooting.Shoot();
            }
        }
    }
コード例 #16
0
    void Start()
    {
        nView           = GetComponent <NetworkView> ();
        playerTransform = GetComponent <Transform> ();
        controller      = GetComponent <CharacterController>();
        shooting        = GetComponent <Shooting>();

        if (nView.isMine)
        {
            AudioListener audioListener = camView.AddComponent <AudioListener>();
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
            GetComponentInChildren <Camera>().enabled = true;
            cameraTransform   = GetComponentInChildren <Camera>().transform;
            shootRayonCurrent = shotStop;
            speed             = walkSpeed;
            rayDistance       = controller.height * .5f + controller.radius;
            slideLimit        = controller.slopeLimit - .1f;
            jumpTimer         = antiBunnyHopFactor;
            Destroy(mesh);
            cameraOrigin = cameraTransform.localPosition;
            cameraCrouch = cameraOrigin + new Vector3(0, -crouchAmount, 0);
            aimSpeedMultiplierCurrent = aimSpeedMultiplier;
        }
        else
        {
            GetComponentInChildren <Camera>().enabled = false;
            camWeapon.SetActive(false);
            Destroy(GetComponent <CapsuleCollider>());
        }
    }
コード例 #17
0
 // Use this for initialization
 void Start()
 {
     anim           = GetComponent <Animator> ();
     shootingScript = GetComponent <Shooting> ();
     rb             = GetComponent <Rigidbody> ();
     collectScript  = GetComponent <CollectSnow> ();
 }
コード例 #18
0
ファイル: Aiming.cs プロジェクト: Realmonia/It-Might-Snowball
 // Use this for initialization
 void Start()
 {
     player_num     = GetComponent <Movement> ().player_num;
     player_camera  = GetComponentInChildren <Camera> ().gameObject;
     cannonScript   = GetComponent <ActivateCannon> ();
     shootingScript = GetComponent <Shooting>();
 }
コード例 #19
0
    IEnumerator DeathAnimation(GameObject boat)
    {
        //turns off scripts for player action
        Aiming      aim   = boat.GetComponentInChildren <Aiming>();
        Shooting    shoot = boat.GetComponentInChildren <Shooting>();
        MovePlayer1 move  = boat.GetComponent <MovePlayer1>();

        aim.enabled   = !aim.enabled;
        move.enabled  = !move.enabled;
        shoot.enabled = !shoot.enabled;

        //stops bgm and starts death sound
        GameManager.aud.Stop();
        GameManager.aud.PlayOneShot(death);

        //plays death animation
        for (int i = 0; i < 50; i++)
        {
            yield return(new WaitForEndOfFrame());

            boat.transform.eulerAngles = boat.transform.eulerAngles + new Vector3(0f, 0f, 18.1f); //rotates object
            boat.transform.localScale  = boat.transform.localScale - new Vector3(.11f, .11f, 0f); //shrinks object
        }
        SceneManager.LoadScene(2);                                                                //loads death scene
    }
コード例 #20
0
ファイル: CharacterSelection.cs プロジェクト: Borgeshc/Arena
    void Start()
    {
        GameObject player = GameObject.Find("Player");

        shooting = player.GetComponent <Shooting>();
        movement = player.GetComponent <Movement>();

        assaultReticleAnimator = assaultReticle.GetComponent <Animator>();
        heavyReticleAnimator   = heavyReticle.GetComponent <Animator>();

        switch (currentClass)
        {
        case Class.assault:
            assaultClass.SetActive(true);
            assaultReticle.SetActive(true);
            cameraController.SetOffset(assaultPosition);
            shooting.SetClassValues(assaultDamage, assaultAttackRange, assaultFireFrequency, assaultAccuracy, assaultMuzzleFlash, assaultAnimator, assaultReticleAnimator);
            movement.SetClassValues(assaultAnimator);
            break;

        case Class.heavy:
            heavyClass.SetActive(true);
            heavyReticle.SetActive(true);
            cameraController.SetOffset(heavyPosition);
            shooting.SetClassValues(heavyDamage, heavyAttackRange, heavyFireFrequency, heavyAccuracy, heavyMuzzleFlash, heavyAnimator, heavyReticleAnimator);
            movement.SetClassValues(heavyAnimator);
            break;
        }
    }
コード例 #21
0
    //Bıçaklı askerin sprite rendererı



    void Start()
    {
        code = GameObject.FindGameObjectWithTag("RifleSoldier");
        //RifleSoldier etiketli oyun objesini kod ile eşleştirmek
        Sh = code.GetComponent <Shooting>();

        moveCode = GameObject.FindGameObjectWithTag("RifleSoldier");

        pm    = moveCode.GetComponent <PlayerMovement_>();
        Enemy = GameObject.FindGameObjectWithTag("Teror");
        Se    = Enemy.GetComponent <ShootingEnemy>();



        //Shooting scriptimizdeki kodu eşleştiriyoruz
        rifle_sol = GameObject.FindGameObjectWithTag("RifleSoldier");
        //RifleSoldier etiketli oyun objesini rile_sol'a atıyourz
        knife_sol_render = GameObject.FindGameObjectWithTag("KnifeSoldier");
        //Tagi knife soldier olan nesnenin özelliklerini atadık
        // knife_sol_sr = knife_sol_render.GetComponent<SpriteRenderer>();
        //Bos bir rendera knife soldierın renderinin özelliklerini atadık
        //atamaları yapıyoruz amk biliyoruz zaten uğraştırıyorsunuz
        knife_pc_ob = GameObject.FindGameObjectWithTag("KnifeSoldier");
        // knife_pc = knife_pc_ob.GetComponent<PolygonCollider2D>();
    }
コード例 #22
0
 // Use this for initialization
 void Start()
 {
     scriptShot      = GameObject.Find("SentinelHead").GetComponent <Shooting>();
     InitialPosition = transform.position;
     healthflag      = false;
     //explosion = GameObject.Find("Explosion").GetComponent<ParticleSystem>();
 }
コード例 #23
0
ファイル: Bullet.cs プロジェクト: JeromeCham/MarioRadioUnity
 void OnTriggerEnter2D(Collider2D hitInfo)
 {
     if (hitInfo.tag == "Dmg")
     {
         //Debug.Log("hit");
         Shooting enemy = hitInfo.GetComponent <Shooting>();
         if (enemy != null)
         {
             enemy.TakeDamage(20);
         }
         Destroy(gameObject);
     }
     if (hitInfo.tag == "Gate")
     {
         Destroy(gameObject);
     }
     if (hitInfo.tag == "Tilemap solid")
     {
         Destroy(gameObject);
     }
     else
     {
         if (destroy == true)
         {
             Destroy(gameObject);
         }
     }
 }
コード例 #24
0
    private void Awake()
    {
        playerMovementController = GetComponent <PlayerMovementController>();
        shooting = GetComponent <Shooting>();

        if (photonView.IsMine)
        {
            playerControlsUIInstance = Instantiate(playerControlsUI);

            playerControlsUIInstance.transform.Find("Fire Button Right").GetComponent <Button>().onClick.AddListener(() => shooting.Fire());
            playerControlsUIInstance.transform.Find("Fire Button Left").GetComponent <Button>().onClick.AddListener(() => shooting.Fire());
            playerControlsUIInstance.transform.Find("Info").GetComponent <TextMeshProUGUI>().text = "Player Alive: " + PhotonNetwork.CurrentRoom.PlayerCount.ToString();

            playerMovementController.joystick        = playerControlsUIInstance.transform.Find("Fixed Joystick").GetComponent <Joystick>();
            playerMovementController.fixedTouchField = playerControlsUIInstance.transform.Find("Rotation Touch Field").GetComponent <FixedTouchField>();


            fpsCamera.enabled = true;
        }
        else
        {
            fpsCamera.enabled = false;
            playerMovementController.enabled = false;
            GetComponent <RigidbodyFirstPersonController>().enabled = false;
        }
    }
コード例 #25
0
ファイル: TempWeaponCollider.cs プロジェクト: yoni1/ldj47
    void OnTriggerEnter2D(Collider2D other)
    {
        Shooting otherShooting = other.gameObject.GetComponent <Shooting>();

        otherShooting.SetTemporaryWeapon(weaponType, weaponDuration);
        Destroy(gameObject);
    }
コード例 #26
0
 // Use this for initialization
 void Start()
 {
     shooting = GetComponent <Shooting> ();
     HealText.SetActive(false);
     collectText.SetActive(false);
     collectScript = GetComponent <CollectSnow> ();
 }
コード例 #27
0
 private void Start()
 {
     rb = GetComponent <Rigidbody>();
     pm = GetComponent <PlayerMovement>();
     m  = GetComponent <Mantling>();
     s  = GetComponent <Shooting>();
 }
コード例 #28
0
 void Start()
 {
     shooting = GetComponent <Shooting> ();
     CollectingUI.transform.parent.gameObject.SetActive(false);
     collectSnow = GetComponent <CollectSnow> ();
     camera      = GetComponentInChildren <Camera> ().gameObject;
 }
コード例 #29
0
    //bool gunReady = true;
    //float startTime = 0;

    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
    }
コード例 #30
0
 void Awake()
 {
     anim = GetComponent<Animator>();
     cc = this.GetComponent<CharacterController>();
     car = GetComponent<CharacterStats>();
     shot = GetComponent<Shooting>();
 }
コード例 #31
0
 private void Awake()
 {
     followDirection = GetComponent <FollowDirection>();
     shooting        = transform.GetChild(0).GetComponent <Shooting>();
     anim            = GetComponent <Animator>();
     rb = GetComponent <Rigidbody2D>();
 }
コード例 #32
0
    private void Start()
    {
        var player = GameObject.FindGameObjectWithTag("Player");

        _ps = player.GetComponent <PlayerStats>();
        _s  = player.GetComponent <Shooting>();
    }
コード例 #33
0
    // Use this for initialization

    public void ReactToHit()
    {
        if (shotcounter == 1)
        {
            Shooting behavior = GetComponent <Shooting> ();
            if (behavior != null)
            {
                behavior.SetAlive(false);
            }

            WanderingNPC b = GetComponent <WanderingNPC> ();
            if (b != null)
            {
                b.SetAlive(false);
            }

            GameObject s  = GameObject.FindGameObjectWithTag("Respawn");
            Spawning   sp = s.GetComponent <Spawning> ();
            sp.decrementCounter();


            StartCoroutine(Die());
        }
        else
        {
            shotcounter++;
        }
    }
コード例 #34
0
ファイル: AddBones.cs プロジェクト: bonbombs/ATermGameJam2015
 public override void callPowerUp()
 {
     shooter = GameObject.Find("button").GetComponent<Shooting>();
     if(shooter.bulletNum + 1 < shooter.maxBullets)
     {
         shooter.bulletNum++;
     }
 }
コード例 #35
0
ファイル: Controllable.cs プロジェクト: krainert/HackAndSlash
 void Start()
 {
     desiredDirection = Quaternion.identity;
     walking = gameObject.GetComponent<Walking> ();
     rotating = gameObject.GetComponent<Rotating> ();
     shooting = gameObject.GetComponent<Shooting> ();
     swinging = gameObject.GetComponent<Swinging> ();
     energy = gameObject.GetComponent<Energy> ();
 }
コード例 #36
0
 // Use this for initialization
 void Start()
 {
     fireScript = GameObject.FindObjectOfType<PlayerMovement>().GetComponent<Shooting>();
     PauseUI.SetActive(false);
     var text = FPSText.GetComponent<Text>();
     text.color = Color.red;
     if (!ShowFps){
         FPSText.SetActive(false);
     }
 }
コード例 #37
0
    void Start()
    {
        bulletSource = GameObject.FindGameObjectWithTag("BulletSource");
        shooting = bulletSource.GetComponent<Shooting> ();

        colorSwitcher = GameObject.FindGameObjectWithTag("ColorController");
        colorController = colorSwitcher.GetComponent<ColorControllerUI> ();

        rectCorners = new Vector3[4];
        shootingImg.GetComponent<RectTransform> ().GetWorldCorners (rectCorners);
    }
コード例 #38
0
ファイル: WeaponItemPickup.cs プロジェクト: HiroLord/VGDesign
 public override void OnTriggerEnter(Component other)
 {
     try{
         shooting = other.GetComponentInChildren<Shooting>();
     } catch(UnityException e){
     }
     string name = this.gameObject.name;
     name = name.Substring(0,name.IndexOf("Item"));
     shooting.addWeaponItem (ItemLibrary.weaponItems [name]);
     destroyObject ();
 }
コード例 #39
0
    // Use this for initialization
    void Start()
    {
        rb = GetComponent<Rigidbody2D> ();
        player = FindObjectOfType<Shooting> ();

        if (player.transform.localScale.x < 0)
        {
            Speed = - Speed;
            RotationSpeed = - RotationSpeed;
        }
    }
コード例 #40
0
    protected override void OnHit(Shooting shooting, Enemy enemy, Vector3 contactPoint)
    {
        if (enemy.Health <= 0)
            return;

        var level = shooting.RainLevel;
        enemy.Health -= Power[Math.Min(level - 1, 2)];

        if (level < 3)
            Destroy(gameObject);

        base.OnHit(shooting, enemy, contactPoint);
    }
コード例 #41
0
	// Use this for initialization

	void Start () 
	{
		if (gameObject.tag == "Player") 
		{
			playerControlled = true;
			health = RPGelements.instance.endingHealth;
			shootScript = transform.FindChild("Gun").GetComponentInChildren<Shooting>();
		}
		if(!playerControlled)
		{
			soldierScript = GetComponent<Soldier>();
		}
		audioSource = GetComponent<AudioSource> ();

		radarSig.SetActive (true);
	}
コード例 #42
0
    public override void Start()
    {
        base.Start();

        Shooting = PlayerTransform.gameObject.GetComponent<Shooting>();

        PowerScale = (float) Math.Pow(PlayerTransform.gameObject.GetComponent<Shooting>().BowLevel, 1);
        if (Shooting.BowLevel == 3)
            gameObject.FindChild("Cube").renderer.material = ColorShifting.Materials["clr_Shift"];

        Origin = transform.position + (PlayerShot ? Vector3.up * (PlayerTransform.localScale.y + 0.5f) : Vector3.zero);
        transform.position = Origin + (transform.rotation * Vector3.right) * transform.localScale.x;
        transform.localScale = new Vector3(0, PowerScale, PowerScale);

        if (!PlayerShot)
            SinceAlive = -0.25f;
    }
コード例 #43
0
	void Start()
	{		
		player = GameObject.FindGameObjectWithTag ("Player");
		playerShooting = player.GetComponentInChildren<Shooting> ();
		levelStartTime = Time.time;
		startTime = delayBeforeFadeStart;
		Invoke ("MakeAllowedToPause", delayBeforeFadeStart);

		if(RPGelements.instance.endingAmmo >= 30)
		{
			playerShooting.ammoGun = 30;
			playerShooting.ammoReserve = RPGelements.instance.endingAmmo - playerShooting.ammoGun;
		}
		else
		{
			playerShooting.ammoGun = RPGelements.instance.endingAmmo;
			playerShooting.ammoReserve = 0;
		}
		playerShooting.UpdateAmmoText ();

		RPGelements.instance.damageTaken = 0;

		RPGelements.instance.HoloText ();

		string text = "MISSION:\n" +
			"Retrieve the TELUMA Algorithm from sublevel " + RPGelements.instance.telumaOnLevel + ".";
		
		whichLevelText1.text = text;
		whichLevelText2.text = text;

		if(doLevelFadeInThing)
		{
			StartCoroutine( DoLevelFadeIn());
		}
		else
		{
			PlayerCanStart();
		}
	}
コード例 #44
0
ファイル: Bullet.cs プロジェクト: Collegiennes/rainCrossBow
    protected virtual void OnHit(Shooting shooting, Enemy enemy, Vector3 contactPoint)
    {
        var dead = enemy.Health <= 0;

        var hitGo = (GameObject)Instantiate(Shooting.HitTemplate);
        hitGo.transform.position = contactPoint + (dead ? Vector3.back * 2 : Vector3.back);
        if (!dead)
            hitGo.transform.localScale /= 2;

        hitGo.GetComponent<HitBehaviour>().Velocity = Vector3.up;
        hitGo.GetComponentInChildren<Renderer>().material = dead ? ColorShifting.Materials["clr_GreyDark"] : ColorShifting.Materials["clr_GreyPale"];

        var randomAmount = 3;
        if (this is CrossBulletBehaviour) randomAmount = 6;

        for (int i = 0; i < randomAmount; i++)
            Wait.Until(t => t >= Random.value, () =>
            {
                var rv = Random.value - 0.5f;
                if (dead) rv /= 2;
                hitGo = (GameObject)Instantiate(Shooting.HitTemplate);
                hitGo.transform.position = contactPoint + (dead ? Vector3.back * 2 : Vector3.back) + new Vector3(rv, rv, 0);
                rv = Random.value - 0.5f;
                hitGo.transform.localScale += new Vector3(rv, rv, rv) * 0.25f;
                hitGo.GetComponent<HitBehaviour>().Velocity = Vector3.up;
                if (!dead)
                    hitGo.transform.localScale /= 2;
                hitGo.GetComponentInChildren<Renderer>().material = dead ? ColorShifting.Materials["clr_GreyDark"] : ColorShifting.Materials["clr_GreyPale"];
            });
    }
コード例 #45
0
ファイル: GuardBehaviour.cs プロジェクト: redahanb/Spectral
    void Start()
    {
        player 			= 		GameObject.FindWithTag ("Player");
        navMeshAgent 	= 		GetComponent<NavMeshAgent> ();
        guardSensing 	= 		GetComponent<GuardSensing> ();
        guardAI 		= 		GetComponent<GuardAI> ();
        guardShooting 	= 		GetComponent<Shooting> ();
        anim 			= 		GetComponent<Animator> ();
        pHealth 		= 		GameObject.Find("Health Manager").GetComponent<HealthManager> ();
        guardBodyParts 	= 		GetComponent<GuardSelfDestruct> ();
        visionCone 		= 		transform.Find ("VisionCone").gameObject;

        // compile patrol and alert routes
        patrolRoute = new Vector3[4]
        {
            waypoint1.transform.position,
            waypoint2.transform.position,
            waypoint3.transform.position,
            waypoint2.transform.position
        };
        alertRoute = new Vector3[4]{
            alertWaypoint1.transform.position,
            alertWaypoint2.transform.position,
            alertWaypoint3.transform.position,
            alertWaypoint2.transform.position
        };
    }
コード例 #46
0
ファイル: Weapon.cs プロジェクト: ZWTGW/unity
 public void StartShooting()
 {
     if(state == null)
     {
         State st = new Shooting(this);
         state = st;
     }
 }
コード例 #47
0
 public override void callPowerUp()
 {
     shooter = GameObject.Find("button").GetComponent<Shooting>();
     shooter.toggleRotate();
 }
コード例 #48
0
 /// <summary>
 /// 
 /// </summary>
 void Start()
 {
     _currentHealth = MaxHealth;
     _currentStamina = MaxStamina;
     _barHeight = Screen.height * 0.04f;
     _barWidth = _barHeight * 10.0f;
     _characterController = FindObjectOfType<CharacterController>().GetComponent<CharacterController>();
     _firstPersonController = FindObjectOfType<FirstPersonController>().GetComponent<FirstPersonController>();
     _lastPosition = transform.position;
     Shooting = GetComponentInChildren<Shooting>();
     _gun = Shooting.gameObject;
     _isDead = false;
     _deathTimeCounter = 0.0f;
 }
コード例 #49
0
ファイル: Player.cs プロジェクト: ellioman/Megaman
    // Constructor
    protected void Awake()
    {
        GameEngine.Player = this;

        Assert.IsNotNull(deathParticlePrefab);
        Assert.IsNotNull(playerTexRend);
        Assert.IsNotNull(playerTexObj);
        Assert.IsTrue(playerMaterials.Count == 17);

        levelCamera = FindObjectOfType<LevelCamera>();
        Assert.IsNotNull(levelCamera);

        movement = gameObject.GetComponent<Movement>();
        Assert.IsNotNull(movement);

        shooting = gameObject.GetComponent<Shooting>();
        Assert.IsNotNull(shooting);

        health = gameObject.GetComponent<Health>();
        Assert.IsNotNull(health);

        col = GetComponent<Collider>();
        Assert.IsNotNull(col);
    }
コード例 #50
0
    // Use this for initialization
    void Awake()
    {
        move = gameObject.GetComponent<Movement>();
        anim = move.anim;
        movement = move.getMove ();
        floorMask = LayerMask.GetMask ("Floor");

        this.shooter = GetComponentInChildren<Shooting> ();
        Debug.Log ("Set Shooter.");
    }
コード例 #51
0
ファイル: AIConstroller.cs プロジェクト: jackielxu/asteroids
	// Use this for initialization
	void Start () {
		playerMovement = player.GetComponent<PlayerMovement> ();
		shooting = player.GetComponent<Shooting> ();
	}
コード例 #52
0
	void Awake()
	{
		playerShooting = GetComponentInChildren<Shooting> ();
		animator = GetComponent<Animator> ();
	}
コード例 #53
0
	void Awake () 
	{
		aStarAI = GetComponent<AstarAI> ();
		gameManager = GameObject.FindGameObjectWithTag ("GameController");
		audioSource = GetComponent<AudioSource> ();

		if(Side == whichSide.Ally)
		{
			myTeamAI = GameObject.Find("Ally COMMANDER").GetComponent<TeamAI>();
			oppositionLayer = LayerMask.GetMask("Enemy");
			oppositionLayerAsString = "Enemy";
		}
		else if(Side == whichSide.Enemy)
		{
			myTeamAI = GameObject.Find("Enemy COMMANDER").GetComponent<TeamAI>();
			oppositionLayer = LayerMask.GetMask("Ally");
			oppositionLayerAsString = "Ally";
		}

		fovCollider = GetComponentInChildren<BoxCollider2D> ();
		suspiciousLayers = oppositionLayer; //TODO: Add corpses to this
		sightBlockLayers = LayerMask.GetMask ("Obstacle", "Door", "Ally", "Enemy");
		myWeapon = transform.FindChild ("Gun").gameObject;
		shootScript = myWeapon.GetComponentInChildren<Shooting> ();
		speed = walkSpeed;
		aStarAI.speed = speed;

		normalStates = new stateMachine[] {stateMachine.Guarding, stateMachine.Patroling};
		curiousStates = new stateMachine[] {stateMachine.CheckingBody, stateMachine.Searching};
		combatStates = new stateMachine[] {stateMachine.Charging, stateMachine.TakingCover, stateMachine.Flanking};
		postCombatStates = new stateMachine[] {stateMachine.CheckingBody, stateMachine.Searching};
	}