Esempio n. 1
0
    private static void MoveSide(GameObject executor, float position)
    {
        CraneController controller = executor.GetComponent <CraneController>();
        float           direction  = Mathf.Sign(position - controller.head.transform.position.x);

        controller.currentVelocity = new Vector2(controller.absVelocity * direction, 0f);
        controller.head.GetComponent <Rigidbody2D>().velocity = controller.currentVelocity;
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        startTime       = Time.time;
        groundHit       = GetComponentInChildren <GroundHit>();
        dropZone        = GetComponentInChildren <DropZone>();
        powerupSpawn    = GetComponentInChildren <PowerupSpawn>();
        craneController = GetComponentInChildren <CraneController>();

        gameOverText.text = "";
    }
Esempio n. 3
0
	void Start()
	{
		rotationPoint = new Vector3 (transform.position.x,
		           					 transform.position.y,
		                             transform.position.z - transform.localScale.z / 2f);
		neckSize = transform.localScale.z;
		grabber = GameObject.Find ("Grabber");
		grabberController = grabber.GetComponent<CraneGrabberController> ();
		craneLight = GameObject.Find ("CraneLight");
		instance = this;
	}
Esempio n. 4
0
    private void SetupControllers()
    {
        if (_gridController == null && GridController.Instance != null)
        {
            _gridController = GridController.Instance;
        }

        if (_craneController == null && CraneController.Instance != null)
        {
            _craneController = CraneController.Instance;
        }
    }
Esempio n. 5
0
    void Start()
    {
        Instance = this;

        _crane           = transform.FindChild("Crane").gameObject;
        _craneGroundCube = _crane.transform.FindChild("GroundCube").gameObject;
        _craneLineCube   = _crane.transform.FindChild("LineCube").gameObject;
        _blocks          = transform.FindChild("Blocks").gameObject;
        _blockProto      = transform.FindChild("BlockProto").gameObject;
        SetGridController();

        _craneResetPosition = new Vector3(
            _crane.transform.localPosition.x,
            craneHeight,
            _crane.transform.localPosition.z);

        Reset();
    }
Esempio n. 6
0
    void HandleKeyInput()
    {
        bool validInput = validKeys.Any(key => Input.GetKeyDown(key));

        if (validInput && GameData.magicPoint > 0)
        {
            GameData.magicPoint -= 1;
            foreach (KeyCode key in GameData.keyEnemyMap.Keys)
            {
                if (Input.GetKeyDown(key))
                {
                    OnEnemyMatch(GameData.GetKeyEnemy(key));
                    CraneController.AttackStart();
                    return;
                }
            }
            AudioManager.PlaySound(AudioManager.SoundList.SE_WRONG);
        }
    }
Esempio n. 7
0
    private static void Grab(GameObject executor, float position)
    {
        CraneController controller  = executor.GetComponent <CraneController>();
        bool            foundButton = false;

        Collider2D[] colliders = Physics2D.OverlapCircleAll(controller.head.transform.position, controller.approximateDistance);
        foreach (Collider2D grabbable in colliders)
        {
            if (grabbable.tag == "Grabbable")
            {
                controller.grabbedObject = grabbable.gameObject.transform;
                foundButton = true;
            }
        }
        if (!foundButton)
        {
            Debug.Log($"Any object from {colliders.Length} grabbables not reachable. Crane is in {executor.transform.position.x} ({executor.name})");
        }
    }
 private void Start()
 {
     if(name == "Up")	isUp = true;
     else				isUp = false;
     craneController = GameObject.FindObjectOfType<CraneController>();
 }
 void Start()
 {
     craneController = GameObject.FindObjectOfType<CraneController>();
     cratesWithinRange = new List<Transform>();
 }
 void Start()
 {
     this.craneController = this.GetComponent <CraneController>();
 }
Esempio n. 11
0
 public void setCraneController(CraneController craneController)
 {
     this.craneController = craneController;
 }