Exemplo n.º 1
0
 def Update(self, this):
     if self.x >= 4.0:
         self.direction = -1
     elif self.x < -4.0:
         self.direction = 1
     self.x += .2 * self.direction * (unity.Time.deltaTime * 100)
     this.transform.position = unity.Vector3(self.x,
                                             this.transform.position.y,
                                             this.transform.position.z)
import UnityEngine as ue
iamPlacing = False
xAllCells = gameObject.Cell(0, 0, "Normal", True, True, ue.Vector2D(0,0), "") #Manully Done in editor
selectedStone = ue.GameObject() //Empty
DM = ue.MonoBehaviour("DuelManager")
SD = ue.MonoBehaviour("StoneDatabase")

class MovementManager():
    def __init__(self, xAllCells, selectedStone, DM, SD, iamPlacing):
        self.xAllCells = xAllCells
        self.selectedStone = selectedStone
        self.DM = DM
        self.iamPlacing

    def Awake():
        SetTrig()
        SD = GameObject.FindGameObjectWithTag("Db").GetComponent("StoneDatabase")
        #Making Player B's Base Non-Walkable for A in the first turn only lol
        CantEnterEnemyBase()

    def SetTrig():
        #Setting Trigger on every Cell
        for a_cell in xAllCells:
            EventTrigger trigger = a_cell.GetComponen("EventTrigger")
            EventTrigger.Entry entry = EventTrigger.Entry()
            entry.eventID = EventTriggerType.PointerDown
            if entry.callback.AddListener == True:
                 OnPointerDownDelegate(a_cell)
            trigger.triggers.Add(entry)

    def OnPointerDownDelegate(a_cell):
Exemplo n.º 3
0
from UnityEngine import Vector3, Color, Renderer
import PythonBehaviour
import UnityEngine

Time = UnityEngine.Time()
Mathf = UnityEngine.Mathf()
lastT = int(Time.time*10)
Debug = UnityEngine.Debug

def Awake():
	global copied
	copied = False
	global iterations
	iterations = 20
def OnEnable():
	pass
	#transform.position += Vector3.up

def OnDisable():
	pass
	#transform.position -= Vector3.up

def Update():
	global lastT
	global copied
	global iterations
	currentT = int(Time.time*10)
	if currentT > 20:
		transform.Rotate(0, UnityEngine.Mathf.Sin((Time.time*10-21)/100)*18*Time.deltaTime*1,0)
		rot = transform.localEulerAngles
		rot[2] = 0
Exemplo n.º 4
0
import UnityEngine as ue

LoreSlot = ""
InstructionSlot = ""
IndexSlot = ""
TitleSlot = ""
StoneImageSlot = ue.Image(None)
currentIndex = 1

backButton = ue.Button() #manual selection
nextButton = ue.Button() #manual selection
StoneDataButton = ue.Button() #manual selection

class StoneLearnData:
    def __init__(self, xName, xLore, xInstruction, xStoneImage):
        self.xName = xName
        self.xLore = xLore
        self.xInstruction = xInstruction
        self.xStoneImage = xStoneImage

stonedb = gameObject.StoneLearnData("defaultName", "defaultLoreText", "defaultGuideText", ue.Image()) #Manully placed in editor

class LearnManager():
    def __init__(self, LoreSlot, InstructionSlot, IndexSlot, TitleSlot, StoneImageSlot, currentIndex, backButton, nextButton, StoneDataButton):
        self.LoreSlot = LoreSlot
        self.InstructionSlot = InstructionSlot
        self.IndexSlot = IndexSlot
        self.TitleSlot = TitleSlot
        self.StoneImageSlot = StoneImageSlot
        self.currentIndex = currentIndex
        self.backButton = backButton
import UnityEngine

objName = "Alice"
    obj = UnityEngine.GameObject()
obj.name = objName
    def Update(self, this):

        if (u.Input.GetKeyDown(u.KeyCode.Space)):
            self.rigid.velocity = u.Vector3(0, 5, 0)
Exemplo n.º 7
0
 def Update(self, this):
     this.transform.Rotate(u.Vector3(20, 20, 10))
     this.transform.position = u.Vector3(u.Mathf.Sin(u.Time.time), 0,
                                         u.Mathf.Cos(u.Time.time))
Exemplo n.º 8
0
#Python initialize file
#Find main camera and change position.
import UnityEngine

camera = UnityEngine.Camera()  #Created a null camera type object

#Find all gameobjects on scene
allGameObjects = UnityEngine.GameObject.FindObjectsOfType(
    UnityEngine.GameObject)

#Find main camera
for go in allGameObjects:
    #Write all game objects name
    UnityEngine.Debug.Log(go.ToString())
    if go.tag == "MainCamera":
        camera = go
#If we found an object tag is "MainCamera" , change position to (10,10,10) and name to "Changed the name of main camera"
if camera != None:
    camera.transform.position = UnityEngine.Vector3(10, 10, 10)
    camera.name = "Changed the name of main camera"
Exemplo n.º 9
0
 def Update(self, this):
     this.transform.Rotate(u.Vector3(2, 2, 1))
Exemplo n.º 10
0
import UnityEngine as ue

StoneData = {
    "xRow" : 0, "xCol" : 0, "xIsA" : False, "xIsAlive" : True, "xIsPlaced" : False, "xIsActive" : True, "xStoneImage" : ue.Image(),
    "xBoosted" : False, "xBlocked" : False, "xName" : "defaultName",
    "xTypeCell" : "Standard", "xHealth" : 1, "xAttackPower" : 0, "xScorePerTurn" : 0, "xMovementHorizontal" : 0,
    "xMovementVertical" : 0, "xMovementDiagonal" : 0, "xCanMoveOnlyForward" : False, "xCanMoveFromThrone" : True, "xScoreExponentialGrowth" : False,
    "xSimpleMergePossible" : False, "xMergeMultiplier" : 0, "xThroneExplosion" : False, "xThroneExplosionSteal" : 0
    }
'''
1. Class used for defining every stone by certain properties.
2. This will also be used to manipulate stone's properties
'''
class stone():
    def __init__(self, StoneData):
        self.StoneDat["xRow"] = StoneData["xRow"]
        self.StoneData["xCol"] = StoneData["xCol"]
        self.StoneData["xIsA"] = StoneData["xIsA"]
        self.StoneData["xIsAlive"] = StoneData["xIsAlive"]
        self.StoneData["xIsPlaced"] = StoneData["xIsPlaced"
        self.StoneData["xIsPlaced"] = StoneData["xIsPlaced"]
        self.StoneData["xStoneImage"] = StoneData["xStoneImage"]
        self.StoneData["xBoosted"] = StoneData["xBoosted"]
        self.StoneData["xBlocked"] = StoneData["xBlocked"]
        self.StoneData["xName"] = StoneData["xName"]
        self.StoneData["xTypeCell"] = StoneData["xTypeCell"]
        self.StoneData["xHealth"] = StoneData["xHealth"]
        self.StoneData["xAttackPower"] = StoneData["xAttackPower"]
        self.StoneData["xScorePerTurn"] = StoneData["xScorePerTurn"]
        self.StoneData["xMovementHorizontal"] = StoneData["xMovementHorizontal"]
        self.StoneData["xMovementVertical"] = StoneData["xMovementVertical"]
Exemplo n.º 11
0
#Python initialize file
#Create a GameObject name is "Created" on Scene
import UnityEngine

gObject = UnityEngine.GameObject("Created")
UnityEngine.Debug.Log("Created a Gameobject!")