Skip to content

Commit

Permalink
add weili branch, balckhole basic setting
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesYWL committed Nov 4, 2019
1 parent 4c1a356 commit af7d2ce
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
17 changes: 16 additions & 1 deletion Projects/Factory/Assets/FactoryGroup0/Resources/BlackHole.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ GameObject:
- component: {fileID: 9205374014997470243}
- component: {fileID: 9205374014997470242}
- component: {fileID: 9205374014997470241}
- component: {fileID: -9091123790211915744}
m_Layer: 0
m_Name: BlackHole
m_TagString: Untagged
Expand All @@ -27,7 +28,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9205374014997470240}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.04, y: 4.1, z: 4.56}
m_LocalPosition: {x: -0.04, y: 4.1, z: 4.54}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -96,3 +97,17 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!114 &-9091123790211915744
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9205374014997470240}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6e0d4771514057e429e1435d4f3552f9, type: 3}
m_Name:
m_EditorClassIdentifier:
FloatStrenght: 1
LifeTime: 3
45 changes: 45 additions & 0 deletions Projects/Factory/Assets/FactoryGroup0/Scripts/BlackHoleMotion.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlackHoleMotion : MonoBehaviour
{
// Start is called before the first frame update
private Rigidbody rd;
private Transform tf;
[SerializeField]
private float FloatStrenght =1;
[SerializeField]
private float LifeTime = 5.0f;
private float timeCounter;
void Start()
{
timeCounter = 0.0f;
rd = this.gameObject.GetComponent<Rigidbody>();
tf = this.gameObject.GetComponent<Transform>();
}

// Update is called once per frame
void Update()
{
if(timeCounter <= LifeTime)
{
//does nothing
}
else
{
if (timeCounter >= 1.5f *LifeTime)
{
Destroy(this.gameObject);
}
else
{
var x = 2 / LifeTime * Time.deltaTime;
tf.localScale -= new Vector3(x, x, x);
FloatStrenght -= x;
}
}
rd.AddForce(-1 * rd.mass * Physics.gravity / 2 * FloatStrenght);
timeCounter += Time.deltaTime;
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Projects/Factory/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2019.3.0b5
m_EditorVersionWithRevision: 2019.3.0b5 (13eef430e0c9)
m_EditorVersion: 2019.3.0b4
m_EditorVersionWithRevision: 2019.3.0b4 (3271e9fc5036)

0 comments on commit af7d2ce

Please sign in to comment.