Proper spraying and wiping of polish objects implemented
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ObjectScript : MonoBehaviour
|
||||
{
|
||||
|
||||
/*public GameObject Dirt;
|
||||
public GameObject Spray;
|
||||
|
||||
void Start(){
|
||||
|
||||
this.gameObject.AddComponent<BoxCollider2D>();
|
||||
Vector3 boundary = this.GetComponent<BoxCollider2D>().size;
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
{
|
||||
float xBound = Random.Range(-boundary.x, boundary.x);
|
||||
float yBound = Random.Range(-boundary.y, boundary.y);
|
||||
|
||||
Instantiate(Dirt, new Vector2(xBound, yBound), Quaternion.identity);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
void OnCollisionStay2D(Collision2D other){
|
||||
/*Texture2D dirt = this.transform.GetChild(0).GetComponent<SpriteRenderer>().sprite.texture;
|
||||
Texture2D spray = this.transform.GetChild(1).GetComponent<SpriteRenderer>().sprite.texture;
|
||||
|
||||
if(!this.transform.GetChild(1).gameObject.activeInHierarchy &&
|
||||
other.gameObject.name == "SprayBottle")
|
||||
{
|
||||
this.transform.GetChild(1).gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if(this.transform.GetChild(1).gameObject.activeInHierarchy &&
|
||||
other.gameObject.name == "Rag")
|
||||
{
|
||||
this.transform.GetChild(0).gameObject.SetActive(false);
|
||||
this.transform.GetChild(1).gameObject.SetActive(false);
|
||||
|
||||
//Debug.Log((int)other.transform.position.x + ", " + (int)other.transform.position.y);
|
||||
|
||||
}*/
|
||||
|
||||
//Debug.Log("Collision");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,8 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 1877631211027388270}
|
||||
- component: {fileID: 1877631211027388271}
|
||||
- component: {fileID: 3195788105519220331}
|
||||
- component: {fileID: 5073414373199561649}
|
||||
m_Layer: 0
|
||||
m_Name: CleanerFluid
|
||||
m_TagString: Untagged
|
||||
@@ -81,3 +83,41 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &3195788105519220331
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1877631211027388265}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fc560be65171acc4ead47d084bd7a4d6, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!61 &5073414373199561649
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1877631211027388265}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 5.12, y: 5.12}
|
||||
newSize: {x: 5.12, y: 5.12}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 5, y: 5}
|
||||
m_EdgeRadius: 0
|
||||
|
||||
@@ -10,6 +10,8 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 5810670192936853656}
|
||||
- component: {fileID: 5810670192936853657}
|
||||
- component: {fileID: -1459335957393884488}
|
||||
- component: {fileID: -4157908487798694971}
|
||||
m_Layer: 0
|
||||
m_Name: Dirt
|
||||
m_TagString: Untagged
|
||||
@@ -81,3 +83,42 @@ SpriteRenderer:
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!114 &-1459335957393884488
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5810670192936853663}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0b84f6fbb4b238041ba94cb90e15c1ce, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Spray: {fileID: 1877631211027388265, guid: cf0e463e9e067dc4680f2204fac7d819, type: 3}
|
||||
--- !u!61 &-4157908487798694971
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5810670192936853663}
|
||||
m_Enabled: 1
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_UsedByEffector: 0
|
||||
m_UsedByComposite: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0.5, y: 0.5}
|
||||
oldSize: {x: 5.12, y: 5.12}
|
||||
newSize: {x: 5.12, y: 5.12}
|
||||
adaptiveTilingThreshold: 0.5
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 4.5, y: 4.5}
|
||||
m_EdgeRadius: 0
|
||||
|
||||
@@ -131,7 +131,6 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 317481905}
|
||||
- component: {fileID: 317481904}
|
||||
- component: {fileID: 317481906}
|
||||
m_Layer: 0
|
||||
m_Name: Object
|
||||
m_TagString: Object
|
||||
@@ -203,18 +202,6 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 2
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &317481906
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 317481903}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1ee23683ea369cc46acd31c562ef7a65, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1 &519420028
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -410,7 +397,6 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
Object: {fileID: 317481903}
|
||||
Dirt: {fileID: 5810670192936853663, guid: 6c319566e78e59d4b848e83cbf6cb8c5, type: 3}
|
||||
Spray: {fileID: 1877631211027388265, guid: cf0e463e9e067dc4680f2204fac7d819, type: 3}
|
||||
ObjectSprites:
|
||||
- {fileID: 21300000, guid: f86f46202b4377743b719984d5bb8396, type: 3}
|
||||
--- !u!4 &1664203757
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DirtScript : MonoBehaviour
|
||||
{
|
||||
public GameObject Spray;
|
||||
|
||||
private bool sprayed = false;
|
||||
|
||||
void OnCollisionEnter2D(Collision2D other){
|
||||
|
||||
if(other.gameObject.name == "SprayBottle" && !sprayed)
|
||||
{
|
||||
sprayed = true;
|
||||
Instantiate(Spray, new Vector2(this.transform.position.x, this.transform.position.y), Quaternion.identity);
|
||||
}
|
||||
|
||||
if(other.gameObject.name == "Rag" && sprayed)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ee23683ea369cc46acd31c562ef7a65
|
||||
guid: 0b84f6fbb4b238041ba94cb90e15c1ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
@@ -7,7 +7,6 @@ public class GameScript : MonoBehaviour
|
||||
|
||||
public GameObject Object;
|
||||
public GameObject Dirt;
|
||||
public GameObject Spray;
|
||||
public Sprite[] ObjectSprites;
|
||||
|
||||
private bool clicked = false;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SprayScript : MonoBehaviour
|
||||
{
|
||||
|
||||
void OnCollisionEnter2D(Collision2D other){
|
||||
|
||||
if(other.gameObject.name == "Rag")
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc560be65171acc4ead47d084bd7a4d6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.8 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Binary file not shown.
Reference in New Issue
Block a user