private void OnTriggerStay(Collider other) { if (_isInUse) { return; } var actor = other.GetComponent <ActiveActor>(); if (actor && GetComponent <PassiveActor>().InteractionPoints.Contains(actor.CurrentInteractionPoint)) { _possibleActor = actor; } }
public void ReleaseActor() { var actor = !string.IsNullOrEmpty(_actorName) ? FallbackActors.FirstOrDefault(x => x.name == _actorName) : FallbackActors.SelectRandomItem(); if (!actor) { return; } _possibleActor = null; var spawnedActor = Instantiate(actor, transform.position, transform.rotation, transform); spawnedActor.transform.parent = transform.parent; spawnedActor.transform.localScale = actor.transform.localScale; //TODO make more abstract spawnedActor.GetComponent <ActiveActor>().EndInteraction("EnterCar"); _isInUse = false; }
private void BuildPageWithUserControls(List <string> fileUrls) { int numberOfActorsAdded = 0; // Set Active Actor string firstActorFile = fileUrls.First(); ActiveActor activeActor = (ActiveActor)LoadControl("~/controls/ActiveActor.ascx"); activeActor.SetImageUrl(firstActorFile); // Add actor to Actors PlaceHolder this.PlaceHolderActors.Controls.Add(activeActor); // Create a Page for this Actor PageTemplate firstActorsPage = (PageTemplate)LoadControl("~/controls/PageTemplate.ascx"); firstActorsPage.SetActorName(Path.GetFileNameWithoutExtension(firstActorFile)); firstActorsPage.SetPageNumber(numberOfActorsAdded.ToString()); // Add it to Page PlaceHolder this.PlaceHolderPages.Controls.Add(firstActorsPage); numberOfActorsAdded++; fileUrls.Remove(firstActorFile); // Continue with other actors foreach (string actorFile in fileUrls) { NextActor nextActor = (NextActor)LoadControl("~/controls/NextActor.ascx"); nextActor.SetImageUrl(actorFile); this.PlaceHolderActors.Controls.Add(nextActor); // Create a Page for this Actor PageTemplate nextActorsPage = (PageTemplate)LoadControl("~/controls/PageTemplate.ascx"); nextActorsPage.SetActorName(Path.GetFileNameWithoutExtension(actorFile)); nextActorsPage.SetPageNumber(numberOfActorsAdded.ToString()); // Add it to Page PlaceHolder this.PlaceHolderPages.Controls.Add(nextActorsPage); numberOfActorsAdded++; } }
private string GetActorName(ActiveActor actor) { return(actor.name.EndsWith("(Clone)") ? actor.name.Substring(0, actor.name.Length - 7) : actor.name); }