public void Start()
    {
        // Find external scripts.
        camShakeScript          = GameObject.Find("CamShake").GetComponent <CameraShake> ();
        parentToTransformScript = GetComponent <ParentToTransform> ();
        timeBodyScript          = GetComponent <TimeBody> ();

        // Finds texture scroll script.
        if (textureScrollScript == null)
        {
            textureScrollScript = GetComponentInChildren <ScrollTextureOverTime> (true);
        }

        // If not connected to a block formation, set property to not connected to block formation.
        if (blockFormationScript == null)
        {
            isBlockFormationConnected = false;
            return;
        }

        // If connected to a block formation, set property to connected.
        if (blockFormationScript != null)
        {
            isBlockFormationConnected = true;
        }
    }
Example #2
0
 void Start()
 {
     animator = GetComponent <Animator>();
     timeBody = GetComponent <TimeBody>();
     CheckOn();
     CheckLocked();
 }
Example #3
0
 void Awake()
 {
     playerBody       = transform.parent;
     inputManager     = transform.parent.GetComponent <InputManager>();
     timeBody         = playerBody.GetComponent <TimeBody>();
     Cursor.lockState = CursorLockMode.Locked;
 }
Example #4
0
 void OnEnable()
 {
     animator              = GetComponent <Animator>();
     playerTimeBody        = transform.GetChild(0).GetComponent <TimeBody>();
     playerAudioSource     = playerTimeBody.GetComponent <AudioSource>();
     PlayerMovement.OnDie += PlayerMovement_OnDie;
 }
Example #5
0
 void Awake()
 {
     _Health     = _initialHealth;
     _Calibrated = false;
     _playerRB   = gameObject.GetComponent <Rigidbody2D>();
     _timeBody   = GetComponent <TimeBody>();
     StartCoroutine(InitialCalibration());
 }
Example #6
0
 public void ShowRewindTimer()
 {
     timeBody = FindObjectOfType <TimeBody>();
     if (timeBody != null)
     {
         SetRewind(timeBody.pointsInTimes.Count);
     }
 }
Example #7
0
 private void Start()
 {
     timer     = gameTimer;
     timeBody  = FindObjectOfType <TimeBody>();
     TotalAmmo = Ammo;
     health    = maxHealth;
     SetMaxHealth(maxHealth);
     timeUpPanel.SetActive(false);
 }
Example #8
0
 public override void Do(TimeBody owner = null)
 {
     if (owner == null)
     {
         ShotDefinition.ActivateForPlayer(ShotOwner, ShotLocation, ShotDirection);
     }
     else
     {
         ShotDefinition.ActivateForGhost(owner.GameObj.GetComponent <Ghost>(), ShotLocation, ShotDirection);
     }
 }
Example #9
0
 void OnEnable()
 {
     aircraft             = Object.Instantiate(DataManager.Instance.choosenAircraft);
     aircraft.fuel        = aircraft.totalFuel;
     aircraft.speed       = aircraft.manufactureSpeed;
     aircraft.maneuver    = aircraft.manufactureManeuver;
     timeMachine          = GetComponent <TimeBody>();
     planeAudio           = GetComponent <AudioSource>();
     propelerCurrentSpeed = propelerNormalSpeed;
     defaultSpawnPosition = this.gameObject.transform.position;
     defaultQuaternion    = this.gameObject.transform.rotation;
 }
Example #10
0
 void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     timeBody    = GetComponent <TimeBody>();
     foreach (Transform item in destinations)
     {
         points.Add(item);
     }
     destination        = points[0].position;
     targetRotation     = points[0].rotation;
     transform.position = points[0].position;
     deltaMovement      = transform.position;
 }
Example #11
0
 void Start()
 {
     if (GetComponent <Animator>() != null)
     {
         animator = GetComponent <Animator>();
     }
     timeBody = GetComponent <TimeBody>();
     foreach (var item in links)
     {
         if (item.GetComponent <Link>() != null)
         {
             item.GetComponent <Link>().Lock(locked);
         }
     }
 }
Example #12
0
 void Awake()
 {
     timeBody    = GetComponent <TimeBody>();
     audioSource = GetComponent <AudioSource>();
     if (active)
     {
         transform.position = positionOn.position;
         destination        = positionOn.position;
     }
     else
     {
         transform.position = positionOff.position;
         destination        = positionOff.position;
     }
     deltaMovement = transform.position;
 }
Example #13
0
    void Shoot()
    {
        // Shoot Ray that only hits things on the TimeTravel Layer
        RaycastHit hit;

        if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range, layerMask))
        {
            // See if it actually has a TimeBody script, if it does initiate the rewind method
            TimeBody timebody = hit.transform.GetComponent <TimeBody>();
            if (timebody != null)
            {
                timebody.StartRewind();
            }
            Debug.Log(hit.transform.name);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        playerRigidbody = this.gameObject.GetComponent <Rigidbody>();
        if (playerRigidbody == null)
        {
            playerRigidbody = this.gameObject.AddComponent <Rigidbody>() as Rigidbody;
        }
        startRotation = this.transform.rotation;



        playerRigidbody.isKinematic = true;
        TimeBody tb = this.gameObject.AddComponent <TimeBody>();

        tb.isPlatform = true;
        if (Object.FindObjectOfType <simplePlatformManager>() == null)
        {
            GameObject platformManager = new GameObject("Platform Manager");
            platformManager.AddComponent <simplePlatformManager>();
        }
    }
Example #15
0
    // Start is called before the first frame update
    void Start()
    {
        // TODO: NUll check errors!!
        _rigidbody2D       = GetComponent <Rigidbody2D>();
        _playerAnimator    = GetComponent <Animator>();
        _playerAudioSource = GetComponent <AudioSource>();

        _playerBodyCollisionBox = GetComponentInChildren <MainPlayerBody>();
        _playerFeetCollisionBox = GetComponentInChildren <MainPlayerFeet>();
        //Debug.Log(_playerBodyCollisionBox.isHittingWall());

        _timeBody = GetComponent <TimeBody>();

        if (!UIManager.Instance)
        {
            UIManager.Instance.UpdatePlayerLives(_playerHealth);
        }
        else
        {
            Debug.LogError("MainPlayer::Start(): UIManager instance not found.");
        }
    }
Example #16
0
        public void OnInit(InitContext context)
        {
            if (context == InitContext.Activate)
            {
                TimeBody = GameObj.GetComponent <TimeBody>();

                loopGhost = () => {
                    var renderer = GameObj.GetComponent <SpriteRenderer>();
                    if (renderer != null)
                    {
                        renderer.ActiveSingle = true;
                    }
                    var physics = GameObj.GetComponent <RigidBody>();
                    if (physics != null)
                    {
                        physics.ActiveSingle = true;
                    }
                    TimeBody.StartReplay(1, true, loopGhost);
                };
                loopGhost();
            }
        }
        private void Start()
        {
            if (!UIManager.Instance)
            {
                Debug.Log("Player::Start(): Could not find UIManager instance.");
            }
            else
            {
                UIManager.Instance.UpdatePlayerCoins(_playerCoins);
                UIManager.Instance.UpdatePlayerLives(_playerLives);
                //UIManager.Instance.UpdateHammerUsage(_hammerUsage);
                UIManager.Instance.UpdateTravelDistance(0);
            }

            _timeBody = GetComponent <TimeBody>();
            if (_timeBody == null)
            {
                Debug.LogWarning("Player::Start(): timebody not assigned.");
            }

            _startPosition = transform.position;

            _playerAudioSource = GetComponent <AudioSource>();
        }
Example #18
0
    void Awake()
    {
        TimeBody tb = this.gameObject.AddComponent <TimeBody>();

        tb.isPlatform = true;
    }
Example #19
0
 public abstract void Do(TimeBody owner = null);
 // Start is called before the first frame update
 void Start()
 {
     _timeBody = GameObject.Find("Player").GetComponent <TimeBody>();
 }
Example #21
0
 public virtual void Awake()
 {
     timeBody = GetComponent <TimeBody>();
 }