public void Update() { if (stopped) { return; } // advance the time float ticksPerSecond = 35f; time += Time.deltaTime; // if we've spent enough time in current sprIndex, advance sprIndex if (time >= state.info[infoIndex].time / ticksPerSecond) { if (state.info[infoIndex].time < 0) { return; } // if time is -1, never advance from here time -= state.info[infoIndex].time / ticksPerSecond; sprIndex++; // if we've run out of sprIndices, advance the infoIndex if (sprIndex >= state.info[infoIndex].sprInd.Length) { sprIndex = 0; infoIndex++; // if we're at the last infoIndex, figure out what function we need to follow if (infoIndex >= state.info.Count - 1) { string func = state.info[infoIndex].function; if (func == "Loop") { // loop to start infoIndex = 0; } else if (func == "Stop") { // stop animating completely stopped = true; infoIndex--; } else { string nextState = func; int nextInfoIndex = 0; if (func.Contains("+")) { // figure out which infoIndex our next state starts from string[] funcSplit = func.Split('+'); nextState = funcSplit[0]; nextInfoIndex = int.Parse(funcSplit[1]); } if (actor.actorStates.ContainsKey(nextState)) { // set our next state from the function variable state = actor.actorStates[nextState]; infoIndex = nextInfoIndex; } else { // we shouldn't end up here, but it's good to cover our bases infoIndex--; } } } if (brightLight != null) { if (state.info[infoIndex].bright) { brightLight.color = state.info[infoIndex].brightColor; brightLight.enabled = true; } else { brightLight.enabled = false; } } } } string funct = state.info[infoIndex].function; if ((funct != "" && funct != null && tCont != null)) { if (funct == "A_Look") { tCont.A_Look(); } else if (funct == "A_Chase") { tCont.A_Chase(); } else if (funct == "A_FaceTarget") { tCont.A_FaceTarget(); } else if (funct == "A_PosAttack") { tCont.A_PosAttack(); } else if (funct == "A_Scream") { tCont.A_Scream(); } else if (funct == "A_NoBlocking") { tCont.A_NoBlocking(); } else if (funct == "A_Pain") { tCont.A_Pain(); } //tCont.Invoke(funct, 0f); } }