// Use this for initialization void Awake() { animController = GetComponent<Animator>(); animParams = animController.parameters; charController = gameObject.AddComponent<Assets.Scripts.Character.CharController>(); charCont = this.gameObject.GetComponent<CharacterController>(); }
void InitVars() { image = GameObject.Find ("Canvas").transform.GetChild (0); textBox = GameObject.Find ("Canvas").transform.GetChild (1).GetComponent<Text> (); player = GameObject.Find ("Player").transform; charContr = player.GetComponent<CharController> (); letterPause = letterPauseDefault; }
// Use this for initialization void Start () { cam = GetComponent<Camera> (); rb = GetComponent<Rigidbody2D> (); targetScript = target.GetComponent<CharController> (); width = cam.pixelWidth; height = cam.pixelHeight; margin = width / 5; }
public void SetSelectedChar(CharController selectedChar) { if (!selectedChar.Equals(selectedCharacter)) { selectedCharacter = selectedChar; selectedChar.SendMessage("OnSelected", SendMessageOptions.DontRequireReceiver); currentlySelectedChar = true; } }
// Use this for initialization void Start() { charController = (CharController)character.GetComponent(typeof(CharController)); scoreController = (ScoreController)camera.GetComponent(typeof(ScoreController)); uiController = (UIController)camera.GetComponent(typeof(UIController)); objectPosition = GetComponent<Transform>().position; moveChar = false; }
void InitVars() { image = GameObject.Find ("Canvas").transform.GetChild (0); cursorImage = GameObject.Find ("Canvas").transform.GetChild (6); textBox = GameObject.Find ("Canvas").transform.GetChild (1).GetComponent<Text> (); answerbox1 = GameObject.Find ("Canvas").transform.GetChild (2).GetComponent<Text> (); answerbox2 = GameObject.Find ("Canvas").transform.GetChild (3).GetComponent<Text> (); answerbox3 = GameObject.Find ("Canvas").transform.GetChild (4).GetComponent<Text> (); answerbox4 = GameObject.Find ("Canvas").transform.GetChild (5).GetComponent<Text> (); player = GameObject.Find ("Player").transform; charContr = player.GetComponent<CharController> (); letterPause = letterPauseDefault; }
// Object 생성 시작 ------------------------- void MakeCharacter(string charactor) { GameObject CharacterRoot = GameObject.Find("CharacterRoot"); charController = CharacterRoot.GetComponent<CharController>(); //GameObject CharacterRoot = (GameObject)GameObject.Instantiate(Resources.Load("Prefebs/Character/pfCharacter")) as GameObject; //CharacterRoot.name = "CharacterRoot"; //CharacterRoot.transform.parent = transform; GameObject CharacterSprite = (GameObject)GameObject.Instantiate(Resources.Load("Prefebs/Character/pfChar_" + charactor)) as GameObject; //GameObject CharacterSprite = GameObject.Find("CharSprite"); CharacterSprite.name = "CharSprite"; CharacterSprite.transform.position = CharacterRoot.transform.position; CharacterSprite.transform.parent = CharacterRoot.transform; Animator animator = CharacterSprite.transform.GetComponent<Animator>(); charController.setInitAni(animator); //charController.setAni(animator); //GameObject.Find("GameCamera").GetComponent<GameCamera>().SetTarget(CharacterRoot.transform); }
// Update is called once per frame void Update() { if (selectedCharacter == null) { return; } if (selectedCharacter.IsDead()) { selectedCharacter = null; } //Right click deselect character if (Input.GetMouseButtonDown(1)) { selectedCharacter = null; } if (!currentlySelectedChar && !currentlyTargetedChar && Input.GetMouseButtonDown(0)) { selectedCharacter.Command_WalkTo( GetWorldClickPosition() ); } currentlySelectedChar = false; currentlyTargetedChar = false; }
void Awake () { Layer = 0; // Ignore "Default" Layer - so we dont hit houses/npc's here raycastIgnoreMask = 1 << Layer; // Set every bit to 1 raycastIgnoreMask = ~raycastIgnoreMask; // And invert it // Set all nescessary values for the NPC npcProperties = new NPCProperties(); npcProperties.id = GameController.instance.npcController.npcList.Count; npcProperties.firstName = "First Name " + npcProperties.id; npcProperties.lastName = "Last Name " + npcProperties.id; npcProperties.gender = Gender.Male; npcProperties.birthdate = new Date(01, 01, 1999); npcProperties.homeBuildingID = 123456; npcProperties.jobBuildingID = 123456; npcProperties.hasHome = false; npcProperties.hasJob = false; npcProperties.speed = 100; npcProperties.currentNPCState = NPCState.Thinking; // GameObject's name name = "NPC_" + npcProperties.id; // Needed to move the NPC controller = GetComponent<CharController>(); seeker = GetComponent<Streetseeker>(); // Add NPC to our global list GameController.instance.npcController.npcList.Add(this); // Start a new path to the targetPosition, return the result to the OnPathComplete function seeker.SearchPath(transform.position, transform.position); path = seeker.Nodes; currentWaypoint = 0; }
public override void DoAction(CharController user) { user.insideBehaviour.TransportToFloor(destinationFloor, destination); }
public abstract void DoAction(CharController user);
void Start() { lastHittedPad = int.MaxValue; charController = GetComponent <CharController>(); pads = FindObjectsOfType <Pad>(); }
// Start is called before the first frame update void Start() { thePlayer = GameObject.Find("Player").GetComponent <CharController>(); line = GetComponent <LineRenderer>(); }
// Use this for initialization void Start() { charController = GameObject.Find("CharacterRoot").GetComponent<CharController>(); uiController = GetComponent<UIController>(); }
void Start() { safariGirl = Camera.main.gameObject.transform.parent.gameObject.GetComponent(typeof(CharController)) as CharController; }
private void UpdateFollowTarget() { if (target != null) { if (!target.isAlive) { target = null; } } CharController[] humans = humanSearch.GetFoundComponents<CharController> (); CharController newTarget = null; foreach (CharController human in humans) { if (human == null) continue; if (human.gameObject == gameObject) continue; if (!human.isAlive) continue; newTarget = human; } if (newTarget != null) { target = newTarget; return; } ZombieController[] zombies = zombieSearch.GetFoundComponents<ZombieController> (); float minDistanceSqr = float.MaxValue; foreach (ZombieController cZombie in zombies) { if (cZombie == null) continue; if (cZombie.gameObject == gameObject) continue; if (!cZombie.isAlive) continue; float distanceSqr = (transform.position - cZombie.transform.position).sqrMagnitude; if (cZombie.isLeader) { newTarget = cZombie; break; } if (distanceSqr < minDistanceSqr) { newTarget = cZombie; minDistanceSqr = distanceSqr; } } if (newTarget != null) { target = newTarget; return; } /* CharController[] chars = FindObjectsOfType<CharController> (); CharController newTarget = null; float minDistanceSqr = float.MaxValue; foreach (CharController chr in chars) { if (chr.gameObject == gameObject) continue; if (!chr.isAlive) continue; float distanceSqr = (transform.position - chr.transform.position).sqrMagnitude; if (distanceSqr > searchRadiusSqr) continue; if (chr.tag == "Human") { newTarget = chr; break; } ZombieController cZombie = chr.GetComponent<ZombieController>(); if (cZombie != null) { if (cZombie.isLeader) { newTarget = cZombie; break; } if (distanceSqr < minDistanceSqr) { newTarget = cZombie; minDistanceSqr = distanceSqr; } } } if (newTarget != null) { target = newTarget; } */ }
virtual public void exit(CharController owner) { }
abstract public void update(CharController owner);
virtual public void enter(CharController owner) { }
void Start() { charController = GetComponent<CharController>(); alive = GetComponent<Alive>(); }
public void setChar(GameObject obj) { charController = obj.GetComponent<CharController>(); }
// Use this for initialization void Start() { charContr = this.GetComponent<CharController> (); animtr = this.GetComponent<Animator> (); }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { cc = player.GetComponent <CharController>(); }
private void Start() { charContr = GetComponent <CharController>(); audio = GetComponent <AudioSource>(); }
private void Start() { CurrentHealth = MaxHealth; controller = GetComponent <CharController>(); }
// Start is called before the first frame update void Start() { cc = GameObject.FindGameObjectWithTag("Player").GetComponent <CharController>(); }
void Start() { charController = GameObject.Find("Character").GetComponent <CharController> (); }
private CharController playerCtrl; //get the player code #endregion Fields #region Methods /// <summary> /// We find the game object Player object /// We also get the charcontroller component and set it to the playerCtrl variable /// </summary> void Start() { player = GameObject.Find ("Player"); playerCtrl = transform.root.GetComponent<CharController>(); }
// restart level without changing the maze or ladder distribution public void RestartSameLevel() { Control.isGameOver = false; ErasePathObjects(); Toggle myToggle = GameObject.Find("mouseclick-toggle").GetComponent <Toggle>(); myToggle.isOn = false; // put char back at (0,0,0) thePlayer.transform.position = new Vector3(0, thePlayer.transform.localScale.y * 0.5f, 0); // transform gates so they are at original position if (gateObjX) { Vector3 p = gateObjX.transform.position; gateObjX.transform.position = new Vector3(p.x, 0.5f, p.z); } if (gateObjZ) { Vector3 p = gateObjZ.transform.position; gateObjZ.transform.position = new Vector3(p.x, 0.5f, p.z); } // destroy prizes + key GameObject prizeGeom = GameObject.Find("Prizes"); if (prizeGeom != null) { foreach (Transform child in prizeGeom.transform) { // clear the map foreach (Node n in nodesHadLittlePrizes) { map[n] = false; } nodesHadLittlePrizes.Clear(); Destroy(child.gameObject); } } // destroy & recreate key GameObject keyGeom = GameObject.Find("Key"); if (keyGeom != null) { map[nodeKeyWasOn] = false; nodeKeyWasOn = null; Destroy(keyGeom.gameObject); MakeKey(); } // make more prizes MakePrizes(Control.numPrizes); // restore the gui GameObject gameOver = GameObject.Find("game over notice"); Text text = gameOver.GetComponent <Text>(); text.text = ""; gameOver = GameObject.Find("score"); text = gameOver.GetComponent <Text>(); text.text = "0"; //GameObject.Find("timer").GetComponent<Text>().text = ""; Control.timer = 0; // restart the first node char is on thePlayer = GameObject.Find("Character"); playerScript = thePlayer.GetComponent <CharController>(); playerScript.AssignFirstCurrNode(allNodes); }
// Use this for initialization void Start() { bushes[0] = transform.GetChild (0).GetComponent<BushScript> (); bushes[1] = transform.GetChild (1).GetComponent<BushScript> (); bushes[2] = transform.GetChild (2).GetComponent<BushScript> (); bushes[3] = transform.GetChild (3).GetComponent<BushScript> (); cat.enabled = false; crash.enabled = false; dialogueBox.GetComponent<BoxCollider2D> ().enabled = false; dialogueBox2.GetComponent<BoxCollider2D>().enabled = false; dialogueBox3.GetComponent<BoxCollider2D>().enabled = false; charContr = GameObject.Find ("Player").GetComponent<CharController> (); ResetRoom (); }
// length, width, numkeys, gate/no gate, "theme"... i guess public void GenerateTheLevelButton() { Control.isGameOver = false; // camera reference cam = Camera.main; // Maze Algorithm /////////////////////////////////// Maze m = new Maze(cam, Control.mazeWidth, Control.mazeLength, 1); goalPos = m.goalPos; m.GenerateMaze(); //display nodes in debug foreach (Node node in m.allNodes) { //node.StartDebugVis(cam); // add all the nodes from the maze into main todo: good idea? idk allNodes.Add(node); if (Vector3.Distance(node.position, new Vector3(0, 0, 0)) < 0.01) { map.Add(node, true); } else if (Vector3.Distance(node.position, goalPos) < 0.01) { map.Add(node, true); } else { map.Add(node, false); } } //create a graph for later use g = new Graph(m.allNodes); // todo: make it allNodes instead of m.allNodes /////////////////////////////////////////////////// // Finding Hard-Coded Node Faces //////////////////// if (pathFaces.Length == 0) { pathFaces = GameObject.FindGameObjectsWithTag("PathFace"); } for (int i = 0; i < pathFaces.Length; i++) { GameObject face = pathFaces[i]; Vector3 normal = Vector3.Normalize(face.transform.up); // is this always the correct normal? should be Node n = new Node(i, "top", face.transform.position, face.transform.up, face.transform.right); float epsilon = 0.01f; if (normal == new Vector3(0, 1, 0)) { n = new Node(i, "top", face.transform.position, face.transform.up, face.transform.right); } else if (normal == new Vector3(-1, 0, 0)) { n = new Node(i, "negx", face.transform.position, face.transform.up, face.transform.right); } else if (normal == new Vector3(0, 0, -1)) { n = new Node(i, "negz", face.transform.position, face.transform.up, face.transform.right); } else if (normal.x > epsilon || normal.x < -epsilon) { if (normal.y > 0) { n = new Node(i, "diagx", face.transform.position, face.transform.up, face.transform.right); } } else if (normal.z > epsilon || normal.z < -epsilon) { if (normal.y > 0) { n = new Node(i, "diagz", face.transform.position, face.transform.up, face.transform.right); } } allNodes.Add(n); } // assign neighbors to nodes automatically //foreach (Node node in allNodes) //{ // // todo: commetn back in ? // //node.FindGeomNeighbors(allNodes, cam); // //node.FindIllusionNeighbors(allNodes, cam); // //node.StartDebugVis(cam); //} // referencing the character variable todo idk if this should be here ? thePlayer = GameObject.Find("Character"); playerScript = thePlayer.GetComponent <CharController>(); playerScript.AssignFirstCurrNode(allNodes); /////////////////////////////////////////////////// if (Control.hasGates) { MakeGatePlusKey(); // this needs to go first to lay down the gate } MakePrizes(Control.numPrizes); // todo: make some limits on dis (i.e. what is the max prizes, also same concern for ladders) // show the play panel and hide the other panel TogglePanelVisibility("start panel"); TogglePanelVisibility("playing panel"); }
// Use this for initialization void Start() { cc = GetComponent <CharController>(); }
void Start() { animator = gameObject.GetComponent <Animator> (); charController = gameObject.GetComponentInParent <CharController>(); }
public abstract bool AvailableForChar(CharController charController);
// Use this for initialization void Start() { myChar = GetComponentInParent <CharController> (); parentCollider = transform.parent.gameObject.GetComponent <Collider2D> (); myAudio = GetComponentInParent <AudioSource> (); }
public virtual void OnExitAction(CharController userLeaving) { }
public override void update(CharController owner) { owner.change_color(Color.clear); SceneManager.LoadScene("End"); }
void Start() { charController = GameObject.Find ("DuckBasic").GetComponent<CharController> (); Map_2.SetActive (false); }
protected override void Awake() { base.Awake(); _charController = GetComponent <CharController>(); }
public override bool AvailableForChar(CharController charController) { return(charController.GetState() == CharState.Outside); }
public CharStateNormal(CharController charController) : base(charController) { }
void Awake() { _charControl = GameObject.FindObjectOfType <CharController>(); }
private Animator throwanim; //Player throw animation #endregion Fields #region Methods /// <summary> /// We get the charcontroller component to reference code. /// </summary> void Start() { playerCtrl = transform.root.GetComponent<CharController>(); }
protected virtual void Awake() { user = GetComponent<CharController>(); }
//private Vector3 groundNormal; // normal vector of object most recently entered void Awake() { controller = GetComponentInParent <CharController> (); activeColliders = new List <Collider>(); }
public override void Interact(CharController actor) { this.input = actor.InputMaster; actor.EnterVehicle(this); }
void Awake() { Character = GetComponent <CharController>(); buttonControls = GameObject.Find("Buttons"); }
void Start() { player = GameObject.FindGameObjectWithTag ("Player"); charController = GameObject.Find ("DuckBasic").GetComponent<CharController> (); Map_2.SetActive (false); }
void Start() { player = GameObject.Find("Player").GetComponent <CharController>(); description.SetActive(false); }
private CharController playerCtrl; // Reference to the PlayerControl script. #endregion Fields #region Methods void Start() { // Setting up the references. playerCtrl = transform.root.GetComponent<CharController>(); }
// Start is called before the first frame update void Start() { Static.SetWearEquip(); Static.Money(); m_joyStick = GameObject.FindObjectOfType <Joystick>( ); m_player = GameObject.FindObjectOfType <CharController>(); canvas = GameObject.Find("Canvas").gameObject; if (canvas != null) { m_uiCanvas = canvas.transform.Find("UI").gameObject; m_whetherPivot = m_uiCanvas.transform.Find("TextPivot"); m_attackBtn = m_uiCanvas.transform.Find("AttackButton").gameObject; m_functionBtn = m_uiCanvas.transform.Find("FunctionBtn").GetComponent <Button>(); m_FOBJ = m_functionBtn.transform.Find("Function").gameObject; m_functionBtn.onClick.AddListener(FunctionBtn); m_invenCanvas = canvas.transform.Find("InvenCanvas").gameObject; m_potionBtn = m_uiCanvas.transform.Find("Potion").GetComponent <Button>(); m_potionImg = m_potionBtn.transform.Find("Image").GetComponent <Image>(); m_potionCount = m_potionBtn.transform.Find("Text").GetComponent <Text>(); m_coolTimeImg = m_potionBtn.transform.Find("CoolTimeImg").GetComponent <Image>(); m_potionBtn.onClick.AddListener(PotionBtn); m_invenBtn = canvas.transform.Find("InvenCanvas/Btn/InventoryBtn").GetComponent <Button>(); m_charInfoBtn = canvas.transform.Find("InvenCanvas/Btn/CharInfoBtn").GetComponent <Button>(); m_invencloseBtn = canvas.transform.Find("InvenCanvas/CloseBtn").GetComponent <Button>(); m_inventoryCanvas = canvas.transform.Find("InvenCanvas/InventoryCanvas").GetComponent <Canvas>(); m_charInfoCanvas = canvas.transform.Find("InvenCanvas/CharInfoCanvas").GetComponent <Canvas>(); } if (m_invenBtn != null) { m_invenBtn.onClick.AddListener(ClickInven); } if (m_charInfoBtn != null) { m_charInfoBtn.onClick.AddListener(ClickChar); } if (m_invencloseBtn != null) { m_invencloseBtn.onClick.AddListener(InvenCloseBtn); } canvas = GameObject.Find("UI/FunctionBtn/Function/Bag"); if (canvas != null) { m_bagBtn = canvas.GetComponent <Button>(); m_bagBtn.onClick.AddListener(BagBtn); } //target UI m_targetUI = GameObject.Find("Canvas/UI").gameObject.transform.Find("TargetUI").gameObject; if (m_targetUI != null) { m_targetSlider = m_targetUI.transform.Find("Slider").GetComponent <Slider>(); m_targetLevel = m_targetUI.transform.Find("Level").GetComponent <Text>(); m_targetName = m_targetUI.transform.Find("Name").GetComponent <Text>(); m_targetValue = m_targetUI.transform.Find("Value").GetComponent <Text>(); } //Boss UI m_bossUI = GameObject.Find("Canvas/UI").gameObject.transform.Find("BossUI").gameObject; if (m_bossUI != null) { m_bossSlider = m_bossUI.transform.Find("Slider").GetComponent <Slider>(); m_bossName = m_bossUI.transform.Find("Name").GetComponent <Text>(); m_bossHpValue = m_bossUI.transform.Find("Value").GetComponent <Text>(); } //skillUI m_skillCanvas = GameObject.Find("Canvas").gameObject.transform.Find("SkillCanvas").gameObject; m_skillBtn = GameObject.Find("Canvas/UI").gameObject.transform.Find("FunctionBtn/Function/Skill").GetComponent <Button>(); if (m_skillBtn != null) { m_skillBtn.onClick.AddListener(SkillBtn); } if (m_skillCanvas != null) { m_skillCloseBtn = m_skillCanvas.transform.Find("CloseBtn").GetComponent <Button>(); } if (m_skillCloseBtn != null) { m_skillCloseBtn.onClick.AddListener(SkillCloseBtn); } //Upgrade m_upgradeCnavas = GameObject.Find("Canvas").gameObject.transform.Find("UpgradeCanvas").gameObject; m_upgradeBtn = m_uiCanvas.transform.Find("FunctionBtn/Function/Upgrade").GetComponent <Button>(); m_upgradeCloseBtn = m_upgradeCnavas.transform.Find("CloseBtn").GetComponent <Button>(); m_upgradeCloseBtn.onClick.AddListener(UpgradeCloseBtn); m_upgradeBtn.onClick.AddListener(UpgradeBtn); m_FOBJ.gameObject.SetActive(false); SetInven(); //Die m_dieCanvas = GameObject.Find("Canvas").transform.Find("Die").gameObject; m_revival = m_dieCanvas.transform.Find("Btn").GetComponent <Button>(); m_revival.onClick.AddListener(Die); //MiniMap m_villageM = m_uiCanvas.transform.Find("MiniMap/VillageM").gameObject; }
protected override void DealDamage(CharController target) { target.DmgBehav.DealPhysicalDamage(info); }
// Use this for initialization void Start() { charController = GameObject.Find ("DuckBasic").GetComponent<CharController> (); gameController = GameObject.Find ("MapController").GetComponent<GameController> (); }