mirror of
https://github.com/frizbee19/FebGameJam.git
synced 2026-11-11 04:22:40 +00:00
3 files changed
+3769
-159
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -2,16 +2,33 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
public enum TestingBehavior {
|
||||||
|
Cycle,
|
||||||
|
Set
|
||||||
|
};
|
||||||
|
|
||||||
public class AnimationControllerTester : MonoBehaviour {
|
public class AnimationControllerTester : MonoBehaviour {
|
||||||
public Animator animator;
|
public Animator animator;
|
||||||
public int numberOfAnimations = 1;
|
public int numberOfAnimations = 1;
|
||||||
public string animationPropertyName = "Animation";
|
public string animationPropertyName = "Animation";
|
||||||
|
public TestingBehavior behavior = TestingBehavior.Cycle;
|
||||||
|
public int setAnimationIndex = 0;
|
||||||
|
|
||||||
|
void Start() {
|
||||||
|
if (animator == null) {
|
||||||
|
animator = GetComponent<Animator>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update() {
|
void Update() {
|
||||||
// Get current time
|
if (behavior == TestingBehavior.Cycle) {
|
||||||
int second = (int) (Time.time / 1.5f);
|
// Get current time
|
||||||
int animationIndex = second % numberOfAnimations;
|
int second = (int) (Time.time / 1.5f);
|
||||||
animator.SetInteger(animationPropertyName, animationIndex);
|
int animationIndex = second % numberOfAnimations;
|
||||||
|
animator.SetInteger(animationPropertyName, animationIndex);
|
||||||
|
} else {
|
||||||
|
animator.SetInteger(animationPropertyName, setAnimationIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,12 +3,14 @@ using System.Collections.Generic;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class WaterSpirit : MonoBehaviour {
|
public class WaterSpirit : MonoBehaviour {
|
||||||
private Transform player;
|
|
||||||
public BoxCollider2D boxCollider;
|
|
||||||
public float swimSpeed = .25f;
|
public float swimSpeed = .25f;
|
||||||
|
|
||||||
|
private BoxCollider2D boxCollider;
|
||||||
|
private Transform player;
|
||||||
private Rigidbody2D rb;
|
private Rigidbody2D rb;
|
||||||
private Vector2 movement = Vector2.zero;
|
private Vector2 movement = Vector2.zero;
|
||||||
private float sizeOffset = 1;
|
private float sizeOffset = 1;
|
||||||
|
private bool activated = false;
|
||||||
|
|
||||||
void Start() {
|
void Start() {
|
||||||
rb = this.GetComponent<Rigidbody2D>();
|
rb = this.GetComponent<Rigidbody2D>();
|
||||||
|
|||||||
Reference in new issue
Block a user