Пример #1
0
    public override void LiveUpdate()
    {
        // steering facing direction
        var lookAngle = Quaternion.LookRotation(aimAt - primaryWeapon.GetShootPointsCentre());

        yawTarget          = Mathf.LerpAngle(yawTarget, lookAngle.eulerAngles.y, 5f * Time.deltaTime);
        transform.rotation = Quaternion.Lerp(transform.rotation, Quaternion.Euler(0f, yawTarget, 0f), 25f * Time.deltaTime);

        Speed += acceleration * Time.deltaTime;

        transform.position += Speed * Vector3.down * Time.deltaTime;

        HeadsUpDisplay.Current.HideCrosshair();
        var        hitRay = new Ray(transform.position, Vector3.down);
        RaycastHit hit;

        if (Physics.Raycast(hitRay, out hit, 20f, LayerMask.GetMask("Player")))
        {
            var inviisbleDestruct = hit.collider.GetComponentInParent <InvisibleDestruct>();
            if (inviisbleDestruct != null)
            {
                Destroy(inviisbleDestruct.gameObject);
            }
        }

        if (Physics.Raycast(hitRay, out hit, Mathf.Abs(Speed * Time.deltaTime + 0.5f), LayerMask.GetMask("Terrain", "Player")))
        {
            transform.position = hit.point;
            WorldSounds.PlayClipAt(transform.position, LandSounds[Random.Range(0, LandSounds.Count)]);
            Land();
            Instantiate(LandEffectPrefab, transform.position, Quaternion.identity);
            TriggerSpawner.TriggerAndDestroy(VehiclePrefab, WeaponPrefab, 0.3f);
            Targeting.RemoveTargetable(Team.Good, GetComponent <Killable>());
            Destroy(this);
        }
    }
Пример #2
0
 public void AlertCall()
 {
     WorldSounds.PlayClipAt(transform.position + Vector3.up, AlertCalls[Random.Range(0, AlertCalls.Count)]);
 }
Пример #3
0
 public void RandomSpeak()
 {
     WorldSounds.PlayClipAt(transform.position + Vector3.up, RandomSpeech[Random.Range(0, RandomSpeech.Count)]);
 }
Пример #4
0
 private void HurtCry(Collider hitcollider, Vector3 position, Vector3 direction, float power, float damage, GameObject attacker)
 {
     WorldSounds.PlayClipAt(transform.position + Vector3.up, HurtCries[Random.Range(0, AlertCalls.Count)]);
 }