1 /** 2 * Copyright (c) 2010-2015, WyrmTale Games and Game Components 3 * All rights reserved. 4 * http://www.wyrmtale.com 5 * 6 * THIS SOFTWARE IS PROVIDED BY WYRMTALE GAMES AND GAME COMPONENTS ‘AS IS‘ AND ANY 7 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 8 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 9 * DISCLAIMED. IN NO EVENT SHALL WYRMTALE GAMES AND GAME COMPONENTS BE LIABLE FOR ANY 10 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 11 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 12 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 13 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 15 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 */ 17 using UnityEngine; 18 using System.Collections; 19 20 // Die subclass to expose the D6 side hitVectors 21 public class Die_d6 : Die 22 { 23 public Rigidbody rigidbody; 24 25 26 void Start() 27 { 28 29 rigidbody = GetComponent<Rigidbody>(); 30 rigidbody.angularVelocity = new Vector3(Random.value, Random.value, Random.value) *Time.deltaTime*Random.Range(100,1000); 31 } 32 override protected Vector3 HitVector(int side) 33 { 34 switch (side) 35 { 36 case 1: return new Vector3(0F, 0F, 1F); 37 print("1"); 38 case 2: return new Vector3(0F, -1F, 0F); 39 print("1"); 40 case 3: return new Vector3(-1F, 0F, 0F); 41 print("1"); 42 case 4: return new Vector3(1F, 0F, 0F); 43 print("1"); 44 case 5: return new Vector3(0F, 1F, 0F); 45 print("1"); 46 case 6: return new Vector3(0F, 0F, -1F); 47 print("1"); 48 } 49 return Vector3.zero; 50 51 } 52 53 54 }
时间: 2024-10-08 03:35:06