private void AdjustBaseSettings() { cPixelHue = GameManager.Color_Dic[EPixelColor]; tPixelTimer = 0f; fTimeToLive_current = fTimeToLive; gameObject.tag = "Pixel"; renderer.material.SetColor("_MainColor", cPixelHue); RB.mass = baseMass + (baseMass * massInertia * (fPixelSize - 1)); cPixelTransparent = new Color(cPixelHue.r, cPixelHue.g, cPixelHue.b, 0); nucleus = GameObject.Find("Nucleus").gameObject.GetComponent <NucleusScript>(); if (nucleus == null) { Debug.Log("Nucleus is not called Nucleus in this scene! ABORT!"); } nucleusOrbit = GameObject.Find("NucleusOrbit").gameObject.GetComponent <NucleusOrbitScript>(); if (nucleusOrbit == null) { Debug.Log("NucleusOrbit is not called NucleusOrbit in this scene! ABORT!"); } nucleusOrbitRadius = nucleusOrbit.fPullRadius + 1; distance_pinkPixel += Random.Range(-5, 6); if (EPixelColor == PixelColors.pink) { RB.mass = mass_pink; } }
void SpawnNucleus(CellScript inputCell) { GameObject newNucleus = (GameObject)Instantiate(nucleus, inputCell.transform.position, inputCell.transform.rotation); NucleusScript script = newNucleus.GetComponent <NucleusScript>(); script.SetChromosome(inputCell.GetChromosome()); script.SetVelocity(inputCell.velocity); script.attachedToCell = false; }
void Awake() { myGenes = new Chromosome(4); playerDetected = false; infected = false; roaming = true; ranged = false; velocity = new Vector3(0, 0, 0); kamikazeTimer = 0.0f; animationOffset = Random.Range(0.0f, 10.0f); animationSpeed = Random.Range(0.7f, 1.3f); infectedTimerScale = 0.0f; rotationAxis = new Vector3(0, 1, 0); rotationSpeed = Random.Range(-MaxAngularVelocity, MaxAngularVelocity); cellPosition = gameObject.transform; gameObject.tag = "Neutral"; infectedType = InfectedSpecialType.REGULAR; skinMeshRenderer = GetComponentInChildren <SkinnedMeshRenderer>(); skinMeshRenderer.SetBlendShapeWeight(0, 100); cellStateMachine = new CellFSM(); cellStateMachine.AddTransition(InfectedCellState.DORMANT, InfectedCellState.CHASINGPLAYER, Chase); cellStateMachine.AddTransition(InfectedCellState.CHASINGPLAYER, InfectedCellState.SEARCHING, StartSearching); cellStateMachine.AddTransition(InfectedCellState.CHASINGPLAYER, InfectedCellState.CHASINGPLAYER, Chase); cellStateMachine.AddTransition(InfectedCellState.SEARCHING, InfectedCellState.CHASINGPLAYER, Chase); cellStateMachine.AddTransition(InfectedCellState.DORMANT, InfectedCellState.DORMANT, GoDormant); cellStateMachine.AddTransition(InfectedCellState.SEARCHING, InfectedCellState.DORMANT, GoDormant); blendShapeChild = GetComponentInChildren <BlendColourScript>(); childNucleus = GetComponentInChildren <NucleusScript>(); }
//TODO: change color of the lightning // Start is called before the first frame update void Start() { NScript = gameObject.GetComponentInParent <NucleusScript>(); }