// Nextweapon. JS -------------------------------------------------------- by Henry Xie // Declaration: Use the Interface Template, weapon sequence, current and next weapon (for name registration) 3. Weapons and two front-end interface text var myskin: guiskin; var weaponsort: Int = 0; private var currentweapon: gameobject; private var nextweapon: gameobject; var weapon0: gameobject; vaR weapon1: gameobject; var weapon2: gameobject; var fronttext1 = ":"; var fronttext2 = "Currently, the weapons are named"; // interface function: if you add 1 ---------------------------------------------------------- in sequence when you press the: currently, the weapon name is ready/sorted +/+ the current weapon name is called function ongui () {GUI. skin = myskin; If (GUI. button (rect (20,200,150, 30), fronttext1 + nextweapon. name) {weaponsort ++;} GUI. label (rect (200, 5,300, 30), fronttext2 + currentweapon. name + "/" + weaponsort);} // function: each frame is sent once ------------------------------------------------------ // if the weapon sequence is 0, the current weapon is 0; the next weapon is weapon 1; the other weapons are 0; the other weapons are 1 and 2, which are pushed as follows // if the weapon sequence is greater than 3, otherwise, 0 (forming a cycle) function Update () {If (weaponsort = 0) {currentweapon = weapon0; nextweapon = weapon1; weapon0.active = true; weapon1.active = false; weapon2.active = false;} If (weaponsort = 1) {currentweapon = weapon1; nextweapon = weapon2; weapon0.active = false; weapon1.active = true; weapon2.active = false ;} if (weaponsort = 2) {currentweapon = weapon2; nextweapon = weapon0; weapon0.active = false; weapon1.active = false; weapon2.active = true;} If (weaponsort> = 3) {weaponsort = 0 ;}}