mirror of
https://github.com/zoriya/Mimireisu.git
synced 2026-06-01 10:08:08 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Blocks
|
||||
{
|
||||
public GameObject block;
|
||||
public int rate;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 66b9b4e51dbe9f44eabf54c5a08fc39c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,44 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Earthworm : MonoBehaviour
|
||||
{
|
||||
public GameObject MiPrefab;
|
||||
public float force = 10;
|
||||
|
||||
void Update ()
|
||||
{
|
||||
float movement = Input.GetAxis("Horizontal");
|
||||
//rb.AddForce(new Vector2(movement * force, 0));
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
AddMi();
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C))
|
||||
RemoveMi();
|
||||
}
|
||||
|
||||
void AddMi()
|
||||
{
|
||||
Transform tsu = transform.GetChild(transform.childCount - 1);
|
||||
GameObject mi = Instantiate(MiPrefab, transform);
|
||||
mi.transform.localPosition = tsu.localPosition;
|
||||
tsu.SetAsLastSibling();
|
||||
tsu.localPosition = new Vector2(0.4f * (transform.childCount - 1), tsu.position.y);
|
||||
tsu.GetComponent<HingeJoint2D>().connectedBody = mi.GetComponent<Rigidbody2D>();
|
||||
mi.GetComponent<HingeJoint2D>().connectedBody = transform.GetChild(transform.childCount - 3).GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
void RemoveMi()
|
||||
{
|
||||
if(transform.childCount > 3)
|
||||
{
|
||||
Transform tsu = transform.GetChild(transform.childCount - 1);
|
||||
Transform mi = transform.GetChild(transform.childCount - 2);
|
||||
Transform lastMi = transform.GetChild(transform.childCount - 3);
|
||||
Vector2 pos = mi.position;
|
||||
Destroy(mi.gameObject);
|
||||
tsu.localPosition = pos;
|
||||
tsu.GetComponent<HingeJoint2D>().connectedBody = lastMi.GetComponent<Rigidbody2D>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 227d16def125efd4fa7f340b2e85a094
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class WordGenerator : MonoBehaviour
|
||||
{
|
||||
public List<Blocks> blocks;
|
||||
|
||||
void Start ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f8350e0949c3b24fb9fdcc139612cb5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user