Ejemplo n.º 1
0
        private void Update()
        {
            targetTimeScale -= Input.GetAxis("Mouse ScrollWheel");
            timeScale        = Mathf.Lerp(timeScale, Mathf.Clamp01(targetTimeScale), 0.1f);
            Time.timeScale   = timeScale;
            radius           = (1 - timeScale) * 6 + 5;
            cam.fieldOfView  = timeScale * 22 + 8;

            if (audioSource != null)
            {
                audioSource.volume = timeScale * 0.7f + 0.3f;
            }


            if (targetTimeScale > 0.8f && secondTarget != null)
            {
                secondTarget = null;
            }

            if (Input.GetButtonDown("Jump"))
            {
                secondTarget    = null;
                targetTimeScale = 1;
            }
        }
 // Use this for initialization
 void Start()
 {
     rb            = GetComponent <Rigidbody>();
     animator      = GetComponent <Animator>();
     hitController = GetComponent <HitController>();
     //Time.timeScale = 0.3f;
 }
Ejemplo n.º 3
0
 public bool CanHitThisTarget(HitController targetHitController)
 {
     if (charController == null)
     {
         return(false);
     }
     if (!charController.isAttacking || dead)
     {
         return(false);
     }
     return(!hitTargets.Contains(targetHitController));
 }
Ejemplo n.º 4
0
        // Use this for initialization
        void Start()
        {
            rb            = GetComponent <Rigidbody>();
            animator      = GetComponent <Animator>();
            hitController = GetComponent <HitController>();
            cam           = Camera.main.transform;
            //Time.timeScale = 0.3f;

            targets = GameObject.FindGameObjectsWithTag("Enemy");

            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
        }
Ejemplo n.º 5
0
        void OnCollisionEnter(Collision col)
        {
            //if (col.impulse == Vector3.zero) return;
            Transform targetParent = col.transform.parent;

            if (targetParent == null || targetParent.name != "Ragdoll" || targetParent == transform.parent)
            {
                return;
            }
            Redirector    targetRedirector    = col.transform.root.GetComponent <Redirector>();
            HitController targetHitController = targetRedirector.hitController;

            if (!hitController.CanHitThisTarget(targetHitController))
            {
                return;
            }
            if (targetHitController.TakeHit(col.gameObject, col.contacts[0].point, Velocity))
            {
                hitController.GiveHit(targetHitController);
            }
        }
        // Use this for initialization
        void Start()
        {
            targetHitController = targetBody.GetComponent <HitController>();

            enemies = new Enemy[enemiesCount];
            for (int i = 0; i < enemiesCount; i++)
            {
            }

            for (int i = 0; i < enemiesCount; i++)
            {
                float      angle = (float)i / enemies.Length * 360;
                Quaternion rot   = Quaternion.Euler(0, angle, 0);
                enemies[i] = new Enemy();
                GameObject enemy = Instantiate(enemyPrefab, targetBody.position + rot * Vector3.forward * 4, rot);
                enemies[i].controller = enemy.GetComponent <Redirector>().enemyController;
                enemies[i].controller.SetEnemyCollectiveController(this);
                enemies[i].controller.targetHead = targetHead;
                enemies[i].controller.targetBody = targetBody;
                enemies[i].tr = enemies[i].controller.transform;
            }
            NewEnemiesCircle();
        }
Ejemplo n.º 7
0
 public void GiveHit(HitController targetHitController)
 {
     hitTargets.Add(targetHitController);
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     redirector    = transform.root.GetComponent <Redirector>();
     hitController = redirector.hitController;
 }