mirror of
https://github.com/chibicitiberiu/frica-de-gaze
synced 2024-02-24 08:23:32 +00:00
AddSpider.cs
This commit is contained in:
parent
96c75a01fc
commit
26b85818a5
@ -46,6 +46,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assets\AddSpider.cs" />
|
||||
<Compile Include="Assets\MiscaPaianjen.cs" />
|
||||
<Compile Include="Assets\RandomSpider.cs" />
|
||||
<Compile Include="Assets\misca2.cs" />
|
||||
|
@ -46,6 +46,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Assets\AddSpider.cs" />
|
||||
<Compile Include="Assets\MiscaPaianjen.cs" />
|
||||
<Compile Include="Assets\RandomSpider.cs" />
|
||||
<Compile Include="Assets\misca2.cs" />
|
||||
|
Binary file not shown.
@ -4,15 +4,38 @@ using System.Collections;
|
||||
public class misca2 : MonoBehaviour {
|
||||
|
||||
public Transform target;
|
||||
public float RotationSpeed;
|
||||
|
||||
IEnumerator Start () {
|
||||
|
||||
//yield return new WaitForSeconds (0.2f);
|
||||
//float width = camera.pixelWidth;
|
||||
Vector3 dis = transform.position - target.position;
|
||||
float xpos = Random.Range (-dis.x, dis.x);
|
||||
while (xpos+dis.x > target.position.x || xpos+dis.x < -target.position.x )
|
||||
/*float speed = 1;
|
||||
//move towards the center of the world (or where ever you like)
|
||||
Vector3 targetPosition = target.position;
|
||||
|
||||
Vector3 currentPosition = this.transform.position;
|
||||
//first, check to see if we're close enough to the target
|
||||
if(Vector3.Distance(currentPosition, targetPosition) > .1f) {
|
||||
Vector3 directionOfTravel = targetPosition - currentPosition;
|
||||
//now normalize the direction, since we only want the direction information
|
||||
directionOfTravel.Normalize();
|
||||
//scale the movement on each axis by the directionOfTravel vector components
|
||||
|
||||
this.transform.Translate(
|
||||
0,
|
||||
(directionOfTravel.y * speed * Time.deltaTime),
|
||||
0,
|
||||
Space.World);
|
||||
}*/
|
||||
//transform.RotateAround (target.position, new Vector3 (0, target.position.y, 0), 0);
|
||||
//transform.position = new Vector3(target.position.x,0.1f+target.position.y,target.position.z);
|
||||
float dis = Vector3.Distance (transform.position, target.position);
|
||||
float xpos = Random.Range (-target.position.x, target.position.x);
|
||||
//while (xpos > target.position.x)
|
||||
xpos = Random.Range (-target.position.x, target.position.x);
|
||||
float zpos = Random.Range (-target.position.z, target.position.z);
|
||||
while (zpos+dis.z > target.position.z)
|
||||
//while (zpos > target.position.z)
|
||||
zpos = Random.Range (-target.position.z, target.position.z);
|
||||
|
||||
Vector3 position = new Vector3(xpos, 0, zpos);
|
||||
@ -21,30 +44,34 @@ public class misca2 : MonoBehaviour {
|
||||
Vector3 pointA = transform.position;
|
||||
//Vector3 pointB = pointA + new Vector3 (0.5f,0,0.5f);
|
||||
while (true) {
|
||||
yield return StartCoroutine(MoveObject(transform, pointA, position, 1.5f));
|
||||
yield return StartCoroutine(MoveObject(transform, position, pointA, 1.5f));
|
||||
while (xpos > target.position.x)
|
||||
yield return StartCoroutine(MoveObject(transform, pointA, position, 0.1f));
|
||||
yield return StartCoroutine(MoveObject(transform, position, pointA, 0.1f));
|
||||
//while (xpos > target.position.x)
|
||||
xpos = Random.Range (-target.position.x, target.position.x);
|
||||
while (zpos > target.position.z || zpos< -target.position.z)
|
||||
zpos = Random.Range (-target.position.z, target.position.z);
|
||||
//while (zpos > target.position.z)
|
||||
zpos = Random.Range (-target.position.z, target.position.z);
|
||||
position.x = xpos;
|
||||
position.y = zpos;
|
||||
position.z = zpos;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator MoveObject (Transform thisTransform, Vector3 startPos, Vector3 endPos, float time) {
|
||||
|
||||
|
||||
float i = 0.0f;
|
||||
float rate = 1.0f / time;
|
||||
float rate = 0.1f / time;
|
||||
while (i < 1.0f) {
|
||||
i += Time.deltaTime * rate;
|
||||
thisTransform.position = Vector3.Lerp(startPos, endPos, i);
|
||||
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ ModelImporter:
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 1
|
||||
globalScale: .200000003
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
|
@ -23,7 +23,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Assembly-CSharp.csproj
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
|
@ -29,7 +29,7 @@ Global
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = Assembly-CSharp.csproj
|
||||
Policies = $0
|
||||
$0.TextStylePolicy = $1
|
||||
|
@ -1,11 +1,11 @@
|
||||
<Properties>
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="MonoDevelop.Default" />
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\misca2.cs">
|
||||
<Files>
|
||||
<File FileName="Assets\misca2.cs" Line="13" Column="29" />
|
||||
<File FileName="Assets\misca2.cs" Line="48" Column="4" />
|
||||
<File FileName="Assets\AddSpider.cs" Line="12" Column="4" />
|
||||
<File FileName="Assets\RandomSpider.cs" Line="1" Column="1" />
|
||||
<File FileName="Assets\MiscaPaianjen.cs" Line="1" Column="1" />
|
||||
<File FileName="Assets\misca3.cs" Line="11" Column="53" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user