Octopus Machine (Initialization) (#367)

* oops! deleted the branch with no backup!

basically have to rebuild prefab. at least i kept the animations and scripts.
not actually that bad but like half an hour of my life was lost getting all these files back together

* started moving animation stuff and allat to a separate Octopus.cs script
* changed order of octopodes; it's much more intuitive for it to be left to right than right to left

i think the sprites are too low res tho :( only 2k for 22 sprites not including the text stuff

* did some stuf

* pushing stuff for unity editor

* basically just everything. still more work that needs to be done tho

* unity update

color stuff idk

* icon
This commit is contained in:
AstrlJelly
2023-03-26 23:30:11 -04:00
committed by GitHub
parent 455692a2cd
commit 85f9b508a2
47 changed files with 9682 additions and 0 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: de8f419d9bb91604dafc0868aa2c400c
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,158 @@
using HeavenStudio.Util;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace HeavenStudio.Games.Scripts_OctopusMachine
{
public class Octopus : MonoBehaviour
{
[SerializeField] Animator anim;
[SerializeField] SpriteRenderer sr;
[SerializeField] bool player;
private OctopusMachine game;
public static Octopus instance;
void Awake()
{
game = OctopusMachine.instance;
}
void Update()
{
}
void LateUpdate()
{
if (Conductor.instance.ReportBeat(ref game.lastReportedBeat)/* && !game.isPreparing && game.bopOn*/)
{
//if (anim.IsAnimationNotPlaying() || anim.IsPlayingAnimationName("Idle"))
if (game.isHappy) {
anim.DoScaledAnimation("Happy", 0.5f);
} else if (game.isAngry) {
anim.DoScaledAnimation("Angry", 0.5f);
} else if (game.isShocked) {
anim.DoScaledAnimation("Oops", 0.5f);
} else {
anim.DoScaledAnimation("Bop", 0.5f);
}
}
}
void OnDestroy()
{
}
public void TogglePresence(bool disappear)
{
gameObject.SetActive(false);
}
public void MissPose()
{
}
public void StartCrouch()
{
}
public void StartYell()
{
/*
if (singing || disappeared) return;
singing = true;
anim.SetBool("Mega", true);
anim.Play("OpenMouth", 0, 0);
shouldMegaClose = true;
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
Jukebox.PlayOneShotGame("gleeClub/LoudWailStart");
currentSound = Jukebox.PlayOneShotGame("gleeClub/LoudWailLoop", -1, currentPitch, 1f, true);
BeatAction.New(game.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(Conductor.instance.songPositionInBeats + 1f, delegate { UnYell(); })
});
*/
}
void UnYell()
{
//if (singing && !anim.GetCurrentAnimatorStateInfo(0).IsName("YellIdle")) anim.Play("YellIdle", 0, 0);
}
public void StartSinging(bool forced = false)
{
/*
if ((singing && !forced) || disappeared) return;
singing = true;
anim.SetBool("Mega", false);
shouldMegaClose = false;
anim.Play("OpenMouth", 0, 0);
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
currentSound = Jukebox.PlayOneShotGame("gleeClub/WailLoop", -1, currentPitch, 1f, true);
*/
}
public void StopSinging(bool mega = false, bool playSound = true)
{
/*
if (!singing || disappeared) return;
singing = false;
anim.Play(mega ? "MegaCloseMouth" : "CloseMouth", 0, 0);
if (currentSound != null) Jukebox.KillLoop(currentSound, 0f);
if (playSound) Jukebox.PlayOneShotGame("gleeClub/StopWail");
*/
}
public void Bop(float beat)
{
if (!game.isPreparing && game.bopOn)
{
if (anim.IsAnimationNotPlaying() || anim.IsPlayingAnimationName("Idle"))
if (game.isHappy) {
anim.DoScaledAnimation("Happy", 0.5f);
} else if (game.isAngry) {
anim.DoScaledAnimation("Angry", 0.5f);
} else if (game.isShocked) {
anim.DoScaledAnimation("Oops", 0.5f);
} else {
anim.DoScaledAnimation("Bop", 0.5f);
}
}
}
public void PlayAnimation(float beat, bool keepBopping, int whichBop)
{
switch (whichBop)
{
case 0:
anim.DoScaledAnimation("Bop", 0.5f);
break;
case 1:
anim.DoScaledAnimation("Happy", 0.5f);
break;
case 2:
anim.DoScaledAnimation("Angry", 0.5f);
break;
case 3:
anim.DoScaledAnimation("Oops", 0.5f);
break;
}
if (keepBopping) {
game.isHappy = whichBop == 1 ? keepBopping : !keepBopping;
game.isAngry = whichBop == 2 ? keepBopping : !keepBopping;
game.isShocked = whichBop == 3 ? keepBopping : !keepBopping;
}
}
public void GameplayModifiers(bool isActive, Color octoColor)
{
gameObject.SetActive(isActive);
sr.color = octoColor;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1958bfc64c2ec3f488a2010e690d7696
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,170 @@
using HeavenStudio.Util;
using System;
using System.Collections.Generic;
using UnityEngine;
// using GhostlyGuy's Balls;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class NtrOctopusMachineLoader
{
public static Minigame AddGame(EventCaller eventCaller) {
return new Minigame("OctopusMachine", "Octopus Machine \n<color=#eb5454>[INITIALIZATION ONLY]</color>", "FFf362B", false, false, new List<GameAction>()
{
new GameAction("Bop", "Bop")
{
function = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.Bop(e.beat, e["disableBop"], e[""], e["whichBop"]);
},
parameters = new List<Param>()
{
new Param("bop", false, "Which Bop?", "Plays a sepcific bop type"),
new Param("whichBop", OctopusMachine.Bops.Bop, "Which Bop?", "Plays a sepcific bop type"),
},
defaultLength = 0.5f,
},
new GameAction("Expand", "Expand")
{
function = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.Expand(e.beat);
},
defaultLength = 1f,
preFunction = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.Prepare(e.beat);
},
},
new GameAction("Prepare", "Prepare")
{
function = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.Prepare(e.beat);
},
defaultLength = 0.5f,
},
new GameAction("OctopusAnimation", "Octopus Animation")
{
function = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.PlayAnimation(e.beat, e["keepWhich"], e["whichBop"]);
},
parameters = new List<Param>()
{
new Param("keepWhich", true, "Bop Like This?", "Keep bopping using the selected bop"),
new Param("whichBop", OctopusMachine.Bops.Bop, "Which Bop?", "Plays a sepcific bop type"),
},
defaultLength = 0.5f,
},
new GameAction("GameplayModifiers", "Gameplay Modifiers")
{
function = delegate {
var e = eventCaller.currentEntity;
OctopusMachine.instance.GameplayModifiers(e.beat, e["color"], e["octoColor"], e["oct1"], e["oct2"], e["oct3"]);
},
parameters = new List<Param>()
{
new Param("color", new Color(1f, 0.84f, 0), "Background Color", "Set the background color"),
new Param("octoColor", new Color(1f, 0.145f, 0.5f), "Octopodes Color", "Set the octopode's color"),
new Param("oct1", true, "Show Octopus 1?", "Keep bopping using the selected bop"),
new Param("oct2", true, "Show Octopus 2?", "Keep bopping using the selected bop"),
new Param("oct3", true, "Show Octopus 3?", "Keep bopping using the selected bop"),
},
defaultLength = 0.5f,
},
});
}
}
}
namespace HeavenStudio.Games
{
using Scripts_OctopusMachine;
public partial class OctopusMachine : Minigame
{
[Header("Sprite Renderers")]
[SerializeField] SpriteRenderer Background;
[Header("Octopodes")]
public Octopus Octopus1;
public Octopus Octopus2;
public Octopus Octopus3;
public bool isHappy;
public bool isAngry;
public bool isShocked;
public bool isPreparing;
public bool bopOn = true;
public float lastReportedBeat = 0f;
public static OctopusMachine instance;
public enum Bops
{
Bop,
Joyful,
Upset,
Shocked,
}
void Awake()
{
instance = this;
}
private void LateUpdate()
{
}
private void AllFunction()
{
//Octopus1;
}
public void Prepare(float beat)
{
//AllAnimate("Prepare");
isPreparing = true;
}
public void Expand(float beat)
{
Debug.Log("expand event rn");
}
public void Bop(float beat, float length, bool doesBop, bool autoBop)
{
bopOn = autoBop;
if (doesBop)
{
for (int i = 0; i < length; i++)
{
BeatAction.New(instance.gameObject, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + i, delegate
{
})
});
}
}
}
public void PlayAnimation(float beat, bool keepBopping, int whichBop)
{
}
public void GameplayModifiers(float beat, Color bgColor, Color octoColor, bool oct1, bool oct2, bool oct3)
{
Background.color = bgColor;
Octopus1.GameplayModifiers(oct1, octoColor);
Octopus2.GameplayModifiers(oct2, octoColor);
Octopus3.GameplayModifiers(oct3, octoColor);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1817db01dd58406419f7d470f9af3187
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: